Skip to content

Plugins vs scripts

Both use the hc name, but they serve different purposes:

Request scriptsPlugins
LifetimeOne-shot per sendLong-lived until deactivated
RuntimeutilityProcess + SESRenderer: registry + IPC; main: same runner
API scopeRequest, variables, tests, responseUI contributions, themes, storage, fs, HTTP hooks, IPC, hc.scripts (same hc as request scripts)
Where definedCollection or request editorInstalled .hcp package

Request scripts cannot call plugin-only APIs. Plugins do not replace collection or request scripts for per-send logic. Main-process plugins can run the same hc API programmatically via hc.scripts.createContext() — see Main API — hc.scripts. For the script hc reference (hc.request, hc.globals, hc.test, and related members), see Request scripts.

Request scripts can import other snippets from the library with relative ESM paths (import { fn } from './helper.js') when the snippet name ends in .js. See Snippets. Plugins ship as installable .hcp packages with a different layout and lifecycle.

Request scripts can read and write global variables with hc.globals.get / hc.globals.set; values persist to Settings → Globals after the send. For structured ephemeral data shared between scripts in one send (objects, arrays, mock fixtures), use hc.data instead — see Request scripts — hc.data. Plugins read merged globals through RequestTabContext.variables and update globals with hc.commands.execute('harborclient:updateGlobalVariables', …) — see Global variables.