Back to Docs

Testing and deploy

The CLI workflow — validate, dev, deploy, logs, and how versioning works.

Every iteration loop uses the same four CLI commands: validate, dev, deploy, logs. Once you've got them in your fingers the feedback loop is fast — save a file and your new code is deployed moments later.

Validate locally

Before you deploy anything, check the manifest is sound:

bash
prosaic extension validate --dir .

This parses prosaic.extension.toml, runs the same manifest checks as deploy, and does a trial build of src/ with esbuild to catch bundler errors. No network calls, no auth needed.

What it catches:

  • Missing or invalid name, version.
  • Unknown scopes, unknown event types, unknown action placements.
  • Broken cron schedules.
  • Missing labels on actions.
  • No triggers declared at all.
  • Incomplete [[connections]] blocks, or connections without the use:http scope.
  • esbuild errors in src/, including a top-level return.

Run it any time you touch the manifest. It's fast.

Deploy

bash
prosaic extension deploy --dir . --entity-id <entity-id>

One command, full pipeline:

  1. Validate (as above).
  2. Bundle src/index.ts with esbuild into a single ES module with no runtime imports.
  3. Look the extension up by name in your workspace: create it on the first run, update its manifest and scopes after that.
  4. Upload the bundle. Prosaic records its SHA-256 hash.
  5. Install it on the given entity, or refresh the installation if it's already there.

Deploying with --entity-id (including every save in dev) re-enables that entity's installation if it was turned off.

Deploying needs the workspace admin role. When you deploy, Prosaic also checks each connection's auth strategy against its fields and allowed hosts, which the local validator doesn't.

Flags worth knowing:

FlagDefaultWhat it does
--dir.Project directory containing prosaic.extension.toml
--entity-id—Install on this entity too. Omit it to update the extension only.

The dev loop

bash
prosaic extension dev --dir . --entity-id <entity-id>

dev deploys once, then watches src/ and the manifest. When you save, it runs the full deploy again. It also polls execution logs every 3 seconds and prints them in your terminal, so you see the result soon after your trigger fires.

Flow:

  1. Edit src/index.ts
  2. Save
  3. The CLI notices the change and redeploys
  4. Trigger the event (post a journal, click the button, wait for cron…)
  5. Watch the logs print

Press Ctrl+C to stop. The deployed version stays — dev deploys the real extension, not a separate dev build.

Logs

After a run has happened, pull the history:

bash
prosaic extension logs <extension-id> --limit 20

Or let the CLI find the extension from the manifest in your project:

bash
prosaic extension logs --dir . --follow
FlagDefaultWhat it does
--followfalsePoll for new executions every 3 seconds
--limit10How many executions to show
--dir—Read the extension name from the manifest

Each execution shows its status, ID, trigger and start time, any log lines you wrote, and — if the run failed — the error.

Versioning

version in the manifest is a string, and it's yours to manage. The platform shows it in Settings → Extensions and does nothing else with it. Bumping it is a convention for tracking what's deployed, not a runtime constraint.

A reasonable approach:

  • Bump the patch (0.0.1 → 0.0.2) when you ship a bugfix.
  • Bump the minor (0.1.0) when you change behaviour.
  • Bump the major when you widen what the extension can do (more scopes, more hosts).

Rolling back is manual — deploy the earlier code again. There's no version history on the platform; use your own source control.

Widening permissions

Each installation records the scopes and hosts it was installed with. If a deploy adds a scope, or a connection host, the installations made before it stop running until someone re-installs them and accepts the new permissions. Event and cron runs are skipped without an entry in prosaic extension logs; clicking an action link fails with GRANT_REQUIRED. Deploying with --entity-id re-installs that one entity; re-install the others from Settings → Extensions.

Removing a scope never pauses anything.

Testing before deploy

The sandbox is hard to replicate locally because of the prosaic.* global and the bridge behind it. The realistic workflow is:

  1. Write the code.
  2. prosaic extension validate --dir . catches manifest issues and build errors.
  3. prosaic extension dev against a test entity. Trigger the event, watch the logs.
  4. Only when that works, install it on a real client entity.

There's no published type declaration for the prosaic global yet, so tsc reports it as an unknown name. Rely on validate and the logs rather than a strict type-check.

If you have more than one workspace, keep a dedicated "dev" workspace and entity for this. Deploying broken code against a client is always uncomfortable.

Disabling and uninstalling

  • Disable on an entity — turn the installation off from Settings → Extensions. The extension stays in the workspace and stops running for that entity. Turn it back on the same way.
  • Delete the extension — removes it from the workspace entirely. Only Prosaic can do this today, so email support@prosaic.works. Executions are kept for audit.

There's no CLI command for either yet. Deploying without --entity-id doesn't uninstall anything; it just skips the install step. Using extensions covers the rest of what a workspace sees and does once an extension is deployed.

Tips that save time

  • Start with --trigger event even if you'll end up on cron. The input payload makes events easier to debug.
  • Put prosaic.log.info('context', prosaic.context) as the first line of any new handler. You'll thank yourself when something surprising lands in input.
  • Use storage.get/set for dedupe. Action links can be double-clicked, and the queue retries a job when the platform fails.
  • Keep the bundle small. Bundles are capped at 5 MB; aim for well under 500 KB.