Skip to content

feat(plugins): add plugin build/deploy/manage commands#9

Merged
kerem-acer merged 3 commits into
mainfrom
feat/plugin-commands
Jun 8, 2026
Merged

feat(plugins): add plugin build/deploy/manage commands#9
kerem-acer merged 3 commits into
mainfrom
feat/plugin-commands

Conversation

@kerem-acer

@kerem-acer kerem-acer commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Adds an insurup plugins command group to author, deploy, and manage server-side plugins from the terminal — reusing the CLI's existing browser/M2M auth, output, and session.

Depends on InsurUp/ts-toolkit#71 (the @insurup/sdk plugin endpoints). Draft until that ships; the ^0.1.31 caret picks up the release, then bun install refreshes the lockfile (adds fflate) and CI goes green.

Commands

command what it does
plugins init <dir> scaffold a plugin project — interactive prompts (or flags) for --id, --language (ts/js), --package-manager (bun/npm/pnpm/yarn), --bundler (bun/esbuild)
plugins build <dir> run the project's own build script (via the chosen/detected PM) -> Jint-safety scan -> zip -> dist/<id>.zip
plugins deploy <dir> [--activate] [--config ...] build, upload (multipart), then optionally activate + set config
plugins list / get / logs inspect installed plugins + invocation logs
plugins activate / enable / disable / config / priority lifecycle management

Design

  • The bundler is the plugin project's choice, not the CLI's. build/deploy run <pm> run build (the project's package.json script — bun build, esbuild, ...), then zip the output. The CLI never hardcodes a bundler. Zipping uses fflate.
  • init is interactive (a select/text prompt helper) with flags for non-interactive/CI use; non-TTY falls back to defaults (ts / bun / bun).
  • The local Jint-safety scan mirrors the host's upload-time check (flags Node/browser globals), so unsafe bundles fail before upload.
  • deploy activates before configuring (config validates against the active version) and re-fetches detail so its output reflects final state.
  • init/build run locally (no auth); everything else uses the standard withClient session.

Verified end-to-end (local stack, @insurup/sdk via bun link)

  • auth login --m2m -> token (client-credentials, scope core-api)
  • bun + ts: init -> deploy --activate --config '{"greeting":"Hola"}' -> v1.0.0 -> triggered customer.updated -> plugins logs shows outcome 0, "Hola from the plugin"; new-version flow (1.1.0) also verified
  • esbuild + js: init --language js --bundler esbuild -> build runs the project's esbuild script -> zip produced; scaffold has no tsconfig + esbuild devDep only
  • typecheck + Biome lint + build all green

🤖 Generated with Claude Code

New `insurup plugins` command group:
- init: scaffold a plugin project — interactive prompts (or flags) for id,
  language (ts|js), package manager (bun|npm|pnpm|yarn), and bundler (bun|esbuild)
- build / deploy: run the project's own package.json `build` script (with the
  chosen/detected package manager), then Jint-safety-scan + zip the output and
  (for deploy) upload via @insurup/sdk, optionally activate + set config
- list / get / logs / activate / enable / disable / config / priority

The bundler is the plugin project's choice (not hardcoded) — the CLI orchestrates
`<pm> run build`. Zipping uses fflate; a select/text prompt helper backs init.

Depends on InsurUp/ts-toolkit#71 (the @insurup/sdk plugin endpoints).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kerem-acer kerem-acer force-pushed the feat/plugin-commands branch from 2c2e89c to 7f0ba78 Compare June 6, 2026 18:42
kerem-acer and others added 2 commits June 8, 2026 12:52
… SDK

- add `insurup plugins remove <id>` (client.plugins.deletePlugin), mirroring the
  disable command, for the new backend DELETE /plugins/{id}
- the logs hook filter passed `hookName`; the SDK option was renamed to `hook`
  (a PluginHook). Pass `{ hook }` and import the PluginHook type.

Verified against a local @insurup/sdk build that has the plugin client: tsc 0
errors, biome clean. NOTE: CI stays red until @insurup/sdk is published with the
plugin client (ts-toolkit#71) and this PR bumps the dependency + regenerates the
frozen lockfile.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Unblocks the plugin commands: 0.1.35 (ts-toolkit#71) ships InsurUpPluginClient
with deletePlugin and the UPPER_SNAKE plugin enums. Regenerates the lockfile,
fixing the frozen-lockfile CI failure.

typecheck / biome / 243 tests / build all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kerem-acer kerem-acer marked this pull request as ready for review June 8, 2026 09:59
@kerem-acer kerem-acer merged commit 6fe1673 into main Jun 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant