# ISIS v2 Workflow Pack and Preset Bundle Import/Export APIs (WS10-009)

Date: 2026-02-24  
Owner: @oshun/isis-team  
Checklist: `WS10-009`  
Ticket: `ISIS2-00117`

## Objective

Add API-level import/export endpoints for workflow packs and preset bundles,
with SDK parity and contract validation for external tooling.

## Existing Implementations Reviewed

Before implementation, these in-repo implementations were analyzed:

- `apps/isis/workflow-registry/src/routes/workflows.ts`
  - existing single-workflow import/export contracts and RBAC handling.
- `apps/isis/workflow-registry/src/services/workflow.service.ts`
  - workflow create/get/version lifecycle methods required for pack and preset
    bundle ingestion.
- `libs/isis/client/src/resources/workflows.ts`
  - current typed workflow import/export SDK surface for extension.

Design decisions from this analysis:

- implement pack/preset routes in workflow-registry alongside existing workflow
  import/export APIs,
- keep export operations as request-body-driven `POST` routes for multi-ID
  payloads,
- support partial import behavior with `continueOnError` controls,
- implement preset bundle import as versioned workflow updates via
  `createVersion` (patch increment), preserving workflow history.

## Delivered API Surface

Added workflow pack endpoints:

- `POST /api/v1/workflows/packs/export`
- `POST /api/v1/workflows/packs/import`

Added preset bundle endpoints:

- `POST /api/v1/workflows/preset-bundles/export`
- `POST /api/v1/workflows/preset-bundles/import`

Behavior highlights:

- pack export supports `includeHistory` and `includeDefinitions`
- pack import supports `importHistory`, visibility override, and
  `continueOnError`
- preset bundle export extracts `preset_*` payload fields from workflow
  definitions
- preset bundle import merges preset payload into workflow definitions and
  creates incremented workflow versions

## SDK Parity

`WorkflowsResource` now supports:

- `exportPack(request)`
- `importPack(request)`
- `exportPresetBundle(request)`
- `importPresetBundle(request)`

Typed request/response contracts were added for all four operations.

## Verification Commands

```bash
pnpm --filter @isis/workflow-registry exec vitest run src/routes/workflows.auth.spec.ts src/openapi.contract.spec.ts --reporter=dot
pnpm --filter @isis/client exec vitest run src/resources/workflows.route-parity.spec.ts --reporter=dot
node scripts/isis/generate-remediation-backlog-v2.mjs
node scripts/isis/validate-v2-compliance-gate.mjs
```
