@checkstack/gitops-backend 0.2.6 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,123 @@
1
1
  # @checkstack/gitops-backend
2
2
 
3
+ ## 0.2.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 50e5f5f: Runtime plugin system: install + uninstall plugins from npm, GitHub releases
8
+ (including private GitHub Enterprise instances), or tarball uploads at
9
+ runtime, with multi-package bundles, dependency-derived compatibility checks,
10
+ multi-instance coordination via a Postgres artifact store, and
11
+ single-coordinator destructive cleanup.
12
+
13
+ Highlights:
14
+
15
+ - New `PluginSource` discriminated union and `PluginInstaller` /
16
+ `PluginInstallerRegistry` interfaces in `@checkstack/backend-api`. The
17
+ GitHub variant accepts an optional `apiBaseUrl` so deployments backed by
18
+ GitHub Enterprise can install from `https://ghe.example.com/api/v3`
19
+ instead of `api.github.com`.
20
+ - New `installPackageMetadataSchema` (Zod) in `@checkstack/common` validates
21
+ every plugin's `package.json` at install time. Required fields: `name`,
22
+ `version`, `description`, `author`, `license`, `checkstack.type`,
23
+ `checkstack.pluginId`. Optional: `checkstack.bundle`,
24
+ `checkstack.usageInstructions`, `checkstack.allowInstallScripts`.
25
+ - New `pluginManagerContract` in `@checkstack/pluginmanager-common` with
26
+ `list`, `previewInstall`, `install`, `previewUninstall`, `uninstall`, and
27
+ `events` procedures.
28
+ - New `@checkstack/pluginmanager-frontend` admin UI: installed-plugins list
29
+ with per-row uninstall (typed-confirmation modal, schema/configs/cascade
30
+ toggles), install page with NPM / Tarball Upload / GitHub Release tabs
31
+ (Catalog tab disabled — coming soon), and an events page surfacing the
32
+ install/uninstall audit log.
33
+ - New `bunx @checkstack/scripts plugin-pack` CLI for plugin authors —
34
+ per-package mode produces an npm-shaped tarball; `--bundle` mode produces
35
+ an outer tarball containing every sibling declared in
36
+ `package.json#checkstack.bundle`. Published to npm so external authors
37
+ can `bunx` it directly without a workspace checkout.
38
+ - Compatibility derived from `package.json#dependencies` ranges
39
+ (`semver.satisfies` against the platform's loaded `@checkstack/*`
40
+ versions) — no separate `compatibility` field.
41
+ - Multi-instance: originator persists artifacts + `plugins` rows + broadcasts
42
+ install/uninstall; receiving instances do in-process register/unregister
43
+ only. Destructive ops (drop schema, delete plugin_configs, delete
44
+ artifacts, delete `plugins` rows) run exactly once on the originator.
45
+ - Fresh-instance bootstrap: `loadPlugins()` hydrates any
46
+ `is_uninstallable=true` plugin missing from `node_modules` from the
47
+ artifact store before normal Phase 1 register.
48
+ - New schema: `plugin_artifacts` (tarball storage), `plugin_install_events`
49
+ (audit/error log). `plugins` extended with `version`, `metadata`,
50
+ `source`, `bundle_id`, `is_primary`. Local plugin sync now writes
51
+ `version` from each plugin's `package.json` so the admin UI shows real
52
+ versions instead of `—`.
53
+ - Tarball-upload endpoint (`POST /api/pluginmanager/upload-tarball`) for
54
+ the install UI; access-gated by `pluginmanager.plugin.manage`.
55
+ - Plugin Manager menu link added to the user menu (main grid, alongside
56
+ Profile / Notification Settings / etc.).
57
+
58
+ Cross-cutting changes:
59
+
60
+ - Backend request/response logging now flows through `rootLogger` (winston)
61
+ instead of `hono/logger`. 5xx responses include the response body inline
62
+ so swallowed early-return errors are visible in the log.
63
+ - The `/api/:pluginId/*` dispatcher now logs which core service is missing
64
+ or which `pluginId` had no metadata when it 500s.
65
+ - New `registerCorePluginMetadata` on `PluginManager` for core routers
66
+ (like the plugin manager itself) that need their metadata visible to the
67
+ RPC dispatcher without going through the full plugin lifecycle.
68
+ - ESLint: `unicorn/no-null` is now disabled globally. Drizzle distinguishes
69
+ between `null` (writes a real SQL NULL) and `undefined` (skip the column
70
+ on insert), so treating them as interchangeable produced latent bugs at
71
+ the persistence boundary. The bulk of the patch-bumped packages above
72
+ reflect lint-fix touches that landed when this rule was relaxed.
73
+ - Workspace-wide license normalization to `Elastic-2.0` (matches
74
+ `LICENSE.md`). Every `package.json` in the workspace now declares the
75
+ same SPDX identifier; the patch bumps capture this.
76
+
77
+ Plugin packages (every `plugins/*`): added a `pack` npm script
78
+ (`bunx @checkstack/scripts plugin-pack`), mirrored each plugin's
79
+ `pluginId` from `plugin-metadata.ts` into `package.json#checkstack.pluginId`
80
+ so install-time validation passes, stubbed any missing required metadata
81
+ fields (`description`, `author`, `license`), and added
82
+ `checkstack.bundle` to multi-package plugin primaries (telegram, rcon, ssh,
83
+ jira, queue-bullmq, queue-memory, cache-memory).
84
+
85
+ Breaking changes:
86
+
87
+ - The legacy single-method `PluginInstaller` interface (`install(packageName)`)
88
+ is removed. Callers must use `coreServices.pluginInstallerRegistry`.
89
+ - The old `pluginAdminContract` and `createPluginAdminRouter` are removed.
90
+ Replaced by `pluginManagerContract` in `@checkstack/pluginmanager-common`
91
+ and `createPluginManagerRouter` in `core/backend`.
92
+ - `@checkstack/test-utils-backend` no longer exports
93
+ `createMockPluginInstaller` / `MockPluginInstaller` (the legacy interface
94
+ it shimmed is gone).
95
+
96
+ Note: bumps are limited to `minor` (for packages with new public API
97
+ surface) and `patch` (for downstream consumers, license normalization,
98
+ and lint fixes). No `major` bumps despite the `PluginInstaller` removal —
99
+ the legacy interface had no third-party consumers in the wild before this
100
+ runtime plugin system landed, and the contract surface is the same shape
101
+ modulo the rename.
102
+
103
+ - Updated dependencies [50e5f5f]
104
+ - @checkstack/backend-api@0.15.0
105
+ - @checkstack/common@0.8.0
106
+ - @checkstack/gitops-common@0.2.2
107
+ - @checkstack/queue-api@0.2.18
108
+ - @checkstack/command-backend@0.1.24
109
+
110
+ ## 0.2.7
111
+
112
+ ### Patch Changes
113
+
114
+ - Updated dependencies [302cd3f]
115
+ - @checkstack/backend-api@0.14.1
116
+ - @checkstack/command-backend@0.1.23
117
+ - @checkstack/queue-api@0.2.17
118
+ - @checkstack/common@0.7.0
119
+ - @checkstack/gitops-common@0.2.1
120
+
3
121
  ## 0.2.6
4
122
 
5
123
  ### Patch Changes
package/package.json CHANGED
@@ -1,23 +1,24 @@
1
1
  {
2
2
  "name": "@checkstack/gitops-backend",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
+ "license": "Elastic-2.0",
4
5
  "type": "module",
5
6
  "main": "src/index.ts",
6
7
  "checkstack": {
7
8
  "type": "backend"
8
9
  },
9
10
  "scripts": {
10
- "typecheck": "tsc --noEmit",
11
+ "typecheck": "tsgo -b",
11
12
  "generate": "drizzle-kit generate",
12
13
  "lint": "bun run lint:code",
13
14
  "lint:code": "eslint . --max-warnings 0"
14
15
  },
15
16
  "dependencies": {
16
- "@checkstack/backend-api": "0.13.1",
17
+ "@checkstack/backend-api": "0.14.1",
17
18
  "@checkstack/gitops-common": "0.2.1",
18
19
  "@checkstack/common": "0.7.0",
19
- "@checkstack/command-backend": "0.1.21",
20
- "@checkstack/queue-api": "0.2.15",
20
+ "@checkstack/command-backend": "0.1.23",
21
+ "@checkstack/queue-api": "0.2.17",
21
22
  "@orpc/server": "^1.13.2",
22
23
  "drizzle-orm": "^0.45.0",
23
24
  "minimatch": "^10.0.0",
@@ -28,7 +29,7 @@
28
29
  "devDependencies": {
29
30
  "@checkstack/drizzle-helper": "0.0.4",
30
31
  "@checkstack/scripts": "0.1.2",
31
- "@checkstack/tsconfig": "0.0.5",
32
+ "@checkstack/tsconfig": "0.0.6",
32
33
  "@types/bun": "^1.3.5",
33
34
  "@types/node": "^20.0.0",
34
35
  "@types/uuid": "^11.0.0",
package/src/router.ts CHANGED
@@ -49,7 +49,7 @@ export const createGitOpsRouter = ({
49
49
  .from(schema.provenance)
50
50
  .where(and(...conditions));
51
51
  const row = result[0];
52
- // eslint-disable-next-line unicorn/no-null
52
+
53
53
  return row ? { ...row, warnings: row.warnings ?? [] } : null;
54
54
  });
55
55
 
@@ -92,8 +92,8 @@ export const createGitOpsRouter = ({
92
92
  type: input.type,
93
93
  target: input.target,
94
94
  pathPattern: input.pathPattern,
95
- baseUrl: input.baseUrl ?? null, // eslint-disable-line unicorn/no-null
96
- authToken: input.authToken ? encrypt(input.authToken) : null, // eslint-disable-line unicorn/no-null
95
+ baseUrl: input.baseUrl ?? null,
96
+ authToken: input.authToken ? encrypt(input.authToken) : null,
97
97
  syncInterval,
98
98
  deletionPolicy: input.deletionPolicy ?? "orphan",
99
99
  });
@@ -127,7 +127,7 @@ export const createGitOpsRouter = ({
127
127
  if (input.data.baseUrl !== undefined) updates.baseUrl = input.data.baseUrl;
128
128
  if (input.data.authToken !== undefined) {
129
129
  // null = explicitly clear token, string = encrypt and store
130
- // eslint-disable-next-line unicorn/no-null
130
+
131
131
  updates.authToken = input.data.authToken ? encrypt(input.data.authToken) : null;
132
132
  }
133
133
  if (input.data.syncInterval !== undefined)
@@ -475,7 +475,7 @@ async function upsertProvenance(params: {
475
475
  // Preserve existing entityId on error retries; update on successful reconcile
476
476
  ...(entityId ? { entityId } : {}),
477
477
  status,
478
- errorMessage: errorMessage ?? null, // eslint-disable-line unicorn/no-null
478
+ errorMessage: errorMessage ?? null,
479
479
  warnings: warnings ?? [],
480
480
  repository: file.repository,
481
481
  filePath: file.filePath,
@@ -502,7 +502,7 @@ async function upsertProvenance(params: {
502
502
  lastSyncHash: contentHash,
503
503
  secretRefs,
504
504
  status,
505
- errorMessage: errorMessage ?? null, // eslint-disable-line unicorn/no-null
505
+ errorMessage: errorMessage ?? null,
506
506
  warnings: warnings ?? [],
507
507
  });
508
508
  }
@@ -518,7 +518,7 @@ async function updateProviderSyncStatus(params: {
518
518
  .update(schema.providers)
519
519
  .set({
520
520
  lastSyncAt: new Date(),
521
- lastSyncError: error ?? null, // eslint-disable-line unicorn/no-null
521
+ lastSyncError: error ?? null,
522
522
  updatedAt: new Date(),
523
523
  })
524
524
  .where(eq(schema.providers.id, providerId));
package/tsconfig.json CHANGED
@@ -1,4 +1,26 @@
1
1
  {
2
2
  "extends": "@checkstack/tsconfig/backend.json",
3
- "include": ["src"]
3
+ "include": [
4
+ "src"
5
+ ],
6
+ "references": [
7
+ {
8
+ "path": "../backend-api"
9
+ },
10
+ {
11
+ "path": "../command-backend"
12
+ },
13
+ {
14
+ "path": "../common"
15
+ },
16
+ {
17
+ "path": "../drizzle-helper"
18
+ },
19
+ {
20
+ "path": "../gitops-common"
21
+ },
22
+ {
23
+ "path": "../queue-api"
24
+ }
25
+ ]
4
26
  }