Files
TREK/server/src/nest/plugins/dev-link.ts
T
Maurice 724c88c201 style: format server and shared with prettier
A mechanical prettier --write over server/src, server/tests, server/scripts
and shared/src with the workspaces' .prettierrc; nothing but layout and
import order changes, and every file keeps the same set of imports. shared
is formatted throughout and its format baseline is empty. The server
baseline keeps the 35 files that Prettier would grow past their lint:size
limit (they need a split first, which is not a formatting change), and the
generated entity files stay as their generator writes them.
2026-10-10 21:23:37 +02:00

26 lines
1.3 KiB
TypeScript

/**
* Dev-link: register a plugin from a LOCAL build directory and hot-reload it
* against a real instance's data (#plugins, developer experience).
*
* This is an explicit, opt-in DEVELOPMENT capability and must NEVER be reachable
* in production. A dev-linked plugin (a) bypasses the install-time signature /
* integrity model — its code mutates live between restarts with no re-consent —
* and (b) under `npm run dev` runs with the OS permission jail OFF. Its DATA access
* is still fully gated by the capability RPC host (grants + the acting user's real
* membership, no impersonation) exactly like any other plugin — code origin never
* touches that gate — but the two properties above are why loading unsigned local
* code must be gated behind an explicit flag on top of the admin + kill-switch gates.
*
* Enable ONLY by setting `TREK_PLUGINS_DEV_LINK` to an explicit truthy value
* (1/true/on/yes). Off (absent/any other value) by default, so it can never be
* silently on in a shared or production deployment.
*/
import { readEnv } from '../../app-config';
export function devLinkEnabled(): boolean {
return readEnv().plugins.devLink;
}
/** Provenance marker stamped on a dev-linked plugin row (free-text `source_repo`). */
export const DEV_LINK_SOURCE = 'local:link';