# ISIS v2 WS07-003: Storyboard-to-Shot Templates with Parameter Inheritance

## Scope

`WS07-003` implements storyboard-to-shot workflow templates that compile
storyboard frames into deterministic shot requests with configurable parameter
inheritance behavior.

## Research and Existing Implementation Alignment

The implementation extends existing workflow/template capabilities instead of
rebuilding execution logic:

- Existing `TemplateEngine` handles prompt expression rendering.
- Existing `SequenceContinuityOrchestrator` handles shot-chain continuity
  orchestration.

This task adds a storyboard compiler that prepares sequence-shot plans and feeds
that existing execution stack.

## Deliverables

1. Added storyboard compiler module:

- `StoryboardShotTemplateCompiler`
- `createStoryboardShotTemplateCompiler`
- Typed storyboard defaults, frames, inheritance config, and compile result
  contracts.

2. Implemented configurable parameter inheritance:

- `cascading` strategy (shot N inherits resolved parameters from shot N-1).
- `global_only` strategy (each shot inherits only global defaults).
- Array merge policies: `append_unique` and `replace`.
- Top-level reset keys to intentionally drop carry-forward parameters.

3. Implemented continuity-aware shot request generation:

- Generates `SequenceShotRequest` entries per frame.
- Merges default + per-frame continuity directives/preset IDs.
- Auto-populates scene continuity scope (`sequenceId`, `shotId`) per shot.
- Adds storyboard metadata + duration into shot `requestParameters`.

4. Implemented deterministic normalization and validation:

- Stable shot ordering by `order` (with input-order tie-break).
- Duplicate shot ID rejection after normalization.
- Warning emission for empty resolved prompts.

5. Added full test coverage:

- Cascading inheritance behavior.
- Global-only inheritance behavior.
- Reset-key behavior.
- Duplicate-shot validation.

6. Exported compiler via package entrypoints:

- `libs/isis/workflows/src/templates/index.ts`
- `libs/isis/workflows/src/index.ts`

## Verification Commands

```bash
pnpm --filter @isis/workflows exec vitest run src/templates/storyboard-shot-templates.spec.ts src/consistency/sequence-orchestration.spec.ts src/consistency/orchestration.spec.ts src/workflows.spec.ts
pnpm --filter @isis/workflows exec tsc -p tsconfig.json --noEmit
node scripts/isis/validate-v2-compliance-gate.mjs
```
