@checkstack/maintenance-common 1.0.0 → 1.1.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 CHANGED
@@ -1,5 +1,156 @@
1
1
  # @checkstack/maintenance-common
2
2
 
3
+ ## 1.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1ef2e79: feat: hotlinks on incidents/maintenances and additional links on systems
8
+
9
+ Users with `manage` access on an incident, maintenance, or system can now
10
+ attach free-form URL "hotlinks" — Jira tickets, runbooks, dashboards, ticket
11
+ tools, etc. — alongside the existing fields.
12
+
13
+ - **Incidents** & **maintenances**: links live on the entity itself and are
14
+ surfaced both in the editor dialog and on the public detail page. Two new
15
+ RPC procedures per plugin (`addLink`, `removeLink`) gated behind the
16
+ existing `manage` access rule. Links are returned as part of
17
+ `getIncident` / `getMaintenance` and cache-invalidated on every link
18
+ mutation.
19
+ - **Systems**: a parallel `system_links` table with `getSystemLinks`,
20
+ `addSystemLink`, `removeSystemLink` procedures. Surfaced inside the
21
+ system editor (next to contacts) and on the read-only system detail
22
+ sidebar. Cache-scoped per-system so list endpoints remain hot.
23
+ - **Shared UI**: a `LinksEditor` component in `@checkstack/ui` does the
24
+ presentation; the three plugins each own their own RPC wiring.
25
+
26
+ Database changes ship as additive migrations (new `incident_links`,
27
+ `maintenance_links`, `system_links` tables, all FK-cascaded on parent
28
+ delete). No existing columns or rows are touched.
29
+
30
+ The system incident and maintenance history pages now sort by relevance:
31
+ active entries (non-`resolved` incidents, `scheduled` or `in_progress`
32
+ maintenances) appear at the top, with creation date descending as the
33
+ tiebreaker.
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [42abfff]
38
+ - Updated dependencies [1ef2e79]
39
+ - Updated dependencies [aa89bc5]
40
+ - Updated dependencies [950d6ec]
41
+ - @checkstack/common@0.9.0
42
+ - @checkstack/catalog-common@2.1.0
43
+ - @checkstack/frontend-api@0.5.0
44
+ - @checkstack/notification-common@1.0.2
45
+ - @checkstack/signal-common@0.2.2
46
+
47
+ ## 1.0.1
48
+
49
+ ### Patch Changes
50
+
51
+ - 50e5f5f: Runtime plugin system: install + uninstall plugins from npm, GitHub releases
52
+ (including private GitHub Enterprise instances), or tarball uploads at
53
+ runtime, with multi-package bundles, dependency-derived compatibility checks,
54
+ multi-instance coordination via a Postgres artifact store, and
55
+ single-coordinator destructive cleanup.
56
+
57
+ Highlights:
58
+
59
+ - New `PluginSource` discriminated union and `PluginInstaller` /
60
+ `PluginInstallerRegistry` interfaces in `@checkstack/backend-api`. The
61
+ GitHub variant accepts an optional `apiBaseUrl` so deployments backed by
62
+ GitHub Enterprise can install from `https://ghe.example.com/api/v3`
63
+ instead of `api.github.com`.
64
+ - New `installPackageMetadataSchema` (Zod) in `@checkstack/common` validates
65
+ every plugin's `package.json` at install time. Required fields: `name`,
66
+ `version`, `description`, `author`, `license`, `checkstack.type`,
67
+ `checkstack.pluginId`. Optional: `checkstack.bundle`,
68
+ `checkstack.usageInstructions`, `checkstack.allowInstallScripts`.
69
+ - New `pluginManagerContract` in `@checkstack/pluginmanager-common` with
70
+ `list`, `previewInstall`, `install`, `previewUninstall`, `uninstall`, and
71
+ `events` procedures.
72
+ - New `@checkstack/pluginmanager-frontend` admin UI: installed-plugins list
73
+ with per-row uninstall (typed-confirmation modal, schema/configs/cascade
74
+ toggles), install page with NPM / Tarball Upload / GitHub Release tabs
75
+ (Catalog tab disabled — coming soon), and an events page surfacing the
76
+ install/uninstall audit log.
77
+ - New `bunx @checkstack/scripts plugin-pack` CLI for plugin authors —
78
+ per-package mode produces an npm-shaped tarball; `--bundle` mode produces
79
+ an outer tarball containing every sibling declared in
80
+ `package.json#checkstack.bundle`. Published to npm so external authors
81
+ can `bunx` it directly without a workspace checkout.
82
+ - Compatibility derived from `package.json#dependencies` ranges
83
+ (`semver.satisfies` against the platform's loaded `@checkstack/*`
84
+ versions) — no separate `compatibility` field.
85
+ - Multi-instance: originator persists artifacts + `plugins` rows + broadcasts
86
+ install/uninstall; receiving instances do in-process register/unregister
87
+ only. Destructive ops (drop schema, delete plugin_configs, delete
88
+ artifacts, delete `plugins` rows) run exactly once on the originator.
89
+ - Fresh-instance bootstrap: `loadPlugins()` hydrates any
90
+ `is_uninstallable=true` plugin missing from `node_modules` from the
91
+ artifact store before normal Phase 1 register.
92
+ - New schema: `plugin_artifacts` (tarball storage), `plugin_install_events`
93
+ (audit/error log). `plugins` extended with `version`, `metadata`,
94
+ `source`, `bundle_id`, `is_primary`. Local plugin sync now writes
95
+ `version` from each plugin's `package.json` so the admin UI shows real
96
+ versions instead of `—`.
97
+ - Tarball-upload endpoint (`POST /api/pluginmanager/upload-tarball`) for
98
+ the install UI; access-gated by `pluginmanager.plugin.manage`.
99
+ - Plugin Manager menu link added to the user menu (main grid, alongside
100
+ Profile / Notification Settings / etc.).
101
+
102
+ Cross-cutting changes:
103
+
104
+ - Backend request/response logging now flows through `rootLogger` (winston)
105
+ instead of `hono/logger`. 5xx responses include the response body inline
106
+ so swallowed early-return errors are visible in the log.
107
+ - The `/api/:pluginId/*` dispatcher now logs which core service is missing
108
+ or which `pluginId` had no metadata when it 500s.
109
+ - New `registerCorePluginMetadata` on `PluginManager` for core routers
110
+ (like the plugin manager itself) that need their metadata visible to the
111
+ RPC dispatcher without going through the full plugin lifecycle.
112
+ - ESLint: `unicorn/no-null` is now disabled globally. Drizzle distinguishes
113
+ between `null` (writes a real SQL NULL) and `undefined` (skip the column
114
+ on insert), so treating them as interchangeable produced latent bugs at
115
+ the persistence boundary. The bulk of the patch-bumped packages above
116
+ reflect lint-fix touches that landed when this rule was relaxed.
117
+ - Workspace-wide license normalization to `Elastic-2.0` (matches
118
+ `LICENSE.md`). Every `package.json` in the workspace now declares the
119
+ same SPDX identifier; the patch bumps capture this.
120
+
121
+ Plugin packages (every `plugins/*`): added a `pack` npm script
122
+ (`bunx @checkstack/scripts plugin-pack`), mirrored each plugin's
123
+ `pluginId` from `plugin-metadata.ts` into `package.json#checkstack.pluginId`
124
+ so install-time validation passes, stubbed any missing required metadata
125
+ fields (`description`, `author`, `license`), and added
126
+ `checkstack.bundle` to multi-package plugin primaries (telegram, rcon, ssh,
127
+ jira, queue-bullmq, queue-memory, cache-memory).
128
+
129
+ Breaking changes:
130
+
131
+ - The legacy single-method `PluginInstaller` interface (`install(packageName)`)
132
+ is removed. Callers must use `coreServices.pluginInstallerRegistry`.
133
+ - The old `pluginAdminContract` and `createPluginAdminRouter` are removed.
134
+ Replaced by `pluginManagerContract` in `@checkstack/pluginmanager-common`
135
+ and `createPluginManagerRouter` in `core/backend`.
136
+ - `@checkstack/test-utils-backend` no longer exports
137
+ `createMockPluginInstaller` / `MockPluginInstaller` (the legacy interface
138
+ it shimmed is gone).
139
+
140
+ Note: bumps are limited to `minor` (for packages with new public API
141
+ surface) and `patch` (for downstream consumers, license normalization,
142
+ and lint fixes). No `major` bumps despite the `PluginInstaller` removal —
143
+ the legacy interface had no third-party consumers in the wild before this
144
+ runtime plugin system landed, and the contract surface is the same shape
145
+ modulo the rename.
146
+
147
+ - Updated dependencies [50e5f5f]
148
+ - @checkstack/catalog-common@2.0.1
149
+ - @checkstack/common@0.8.0
150
+ - @checkstack/frontend-api@0.4.2
151
+ - @checkstack/notification-common@1.0.1
152
+ - @checkstack/signal-common@0.2.1
153
+
3
154
  ## 1.0.0
4
155
 
5
156
  ### Major Changes
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@checkstack/maintenance-common",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
+ "license": "Elastic-2.0",
4
5
  "type": "module",
5
6
  "exports": {
6
7
  ".": {
@@ -8,21 +9,21 @@
8
9
  }
9
10
  },
10
11
  "dependencies": {
11
- "@checkstack/common": "0.7.0",
12
- "@checkstack/catalog-common": "1.5.3",
13
- "@checkstack/frontend-api": "0.4.0",
14
- "@checkstack/notification-common": "0.3.0",
15
- "@checkstack/signal-common": "0.2.0",
12
+ "@checkstack/common": "0.8.0",
13
+ "@checkstack/catalog-common": "2.0.1",
14
+ "@checkstack/frontend-api": "0.4.2",
15
+ "@checkstack/notification-common": "1.0.1",
16
+ "@checkstack/signal-common": "0.2.1",
16
17
  "@orpc/contract": "^1.13.14",
17
18
  "zod": "^4.2.1"
18
19
  },
19
20
  "devDependencies": {
20
21
  "typescript": "^5.7.2",
21
- "@checkstack/tsconfig": "0.0.5",
22
- "@checkstack/scripts": "0.1.2"
22
+ "@checkstack/tsconfig": "0.0.7",
23
+ "@checkstack/scripts": "0.3.0"
23
24
  },
24
25
  "scripts": {
25
- "typecheck": "tsc --noEmit",
26
+ "typecheck": "tsgo -b",
26
27
  "lint": "bun run lint:code",
27
28
  "lint:code": "eslint . --max-warnings 0"
28
29
  },
package/src/index.ts CHANGED
@@ -10,6 +10,8 @@ export {
10
10
  MaintenanceWithSystemsSchema,
11
11
  MaintenanceUpdateSchema,
12
12
  MaintenanceDetailSchema,
13
+ MaintenanceLinkSchema,
14
+ AddMaintenanceLinkInputSchema,
13
15
  CreateMaintenanceInputSchema,
14
16
  UpdateMaintenanceInputSchema,
15
17
  AddMaintenanceUpdateInputSchema,
@@ -18,6 +20,8 @@ export {
18
20
  type MaintenanceWithSystems,
19
21
  type MaintenanceUpdate,
20
22
  type MaintenanceDetail,
23
+ type MaintenanceLink,
24
+ type AddMaintenanceLinkInput,
21
25
  type CreateMaintenanceInput,
22
26
  type UpdateMaintenanceInput,
23
27
  type AddMaintenanceUpdateInput,
@@ -6,6 +6,8 @@ import {
6
6
  MaintenanceWithSystemsSchema,
7
7
  MaintenanceDetailSchema,
8
8
  MaintenanceUpdateSchema,
9
+ MaintenanceLinkSchema,
10
+ AddMaintenanceLinkInputSchema,
9
11
  CreateMaintenanceInputSchema,
10
12
  UpdateMaintenanceInputSchema,
11
13
  AddMaintenanceUpdateInputSchema,
@@ -102,6 +104,24 @@ export const maintenanceContract = {
102
104
  .input(z.object({ id: z.string(), message: z.string().optional() }))
103
105
  .output(MaintenanceWithSystemsSchema),
104
106
 
107
+ /** Add a hotlink (e.g. change ticket, runbook) to a maintenance */
108
+ addLink: proc({
109
+ operationType: "mutation",
110
+ userType: "authenticated",
111
+ access: [maintenanceAccess.maintenance.manage],
112
+ })
113
+ .input(AddMaintenanceLinkInputSchema)
114
+ .output(MaintenanceLinkSchema),
115
+
116
+ /** Remove a hotlink from a maintenance */
117
+ removeLink: proc({
118
+ operationType: "mutation",
119
+ userType: "authenticated",
120
+ access: [maintenanceAccess.maintenance.manage],
121
+ })
122
+ .input(z.object({ id: z.string() }))
123
+ .output(z.object({ success: z.boolean() })),
124
+
105
125
  /** Delete a maintenance */
106
126
  deleteMaintenance: proc({
107
127
  operationType: "mutation",
package/src/schemas.ts CHANGED
@@ -52,10 +52,32 @@ export const MaintenanceUpdateSchema = z.object({
52
52
  export type MaintenanceUpdate = z.infer<typeof MaintenanceUpdateSchema>;
53
53
 
54
54
  /**
55
- * Full maintenance detail with systems and updates
55
+ * Free-form hotlink attached to a maintenance (e.g. change ticket, runbook).
56
+ */
57
+ export const MaintenanceLinkSchema = z.object({
58
+ id: z.string(),
59
+ maintenanceId: z.string(),
60
+ label: z.string().nullable(),
61
+ url: z.string(),
62
+ createdAt: z.date(),
63
+ });
64
+ export type MaintenanceLink = z.infer<typeof MaintenanceLinkSchema>;
65
+
66
+ export const AddMaintenanceLinkInputSchema = z.object({
67
+ maintenanceId: z.string(),
68
+ label: z.string().max(120).optional(),
69
+ url: z.string().url("Must be a valid URL"),
70
+ });
71
+ export type AddMaintenanceLinkInput = z.infer<
72
+ typeof AddMaintenanceLinkInputSchema
73
+ >;
74
+
75
+ /**
76
+ * Full maintenance detail with systems, updates, and hotlinks
56
77
  */
57
78
  export const MaintenanceDetailSchema = MaintenanceWithSystemsSchema.extend({
58
79
  updates: z.array(MaintenanceUpdateSchema),
80
+ links: z.array(MaintenanceLinkSchema),
59
81
  });
60
82
  export type MaintenanceDetail = z.infer<typeof MaintenanceDetailSchema>;
61
83
 
package/tsconfig.json CHANGED
@@ -2,5 +2,22 @@
2
2
  "extends": "@checkstack/tsconfig/common.json",
3
3
  "include": [
4
4
  "src"
5
+ ],
6
+ "references": [
7
+ {
8
+ "path": "../catalog-common"
9
+ },
10
+ {
11
+ "path": "../common"
12
+ },
13
+ {
14
+ "path": "../frontend-api"
15
+ },
16
+ {
17
+ "path": "../notification-common"
18
+ },
19
+ {
20
+ "path": "../signal-common"
21
+ }
5
22
  ]
6
- }
23
+ }