Skip to content

Pluggable output formats (JSON, Markdown, MCP) #10

Description

@BraedenBDev

Output is currently rendered as plain text via `src/shared/formatter.ts`. This works for clipboard-paste workflows, but programmatic consumers (CI tools, coding agents, extensions) need structured formats.

Proposed formats:

  1. JSON — machine-readable capture payload. Element selector, component info, annotations as coordinate arrays, transcription segments with timestamps. Direct input for tool integrations.
  2. Markdown — formatted for pasting into GitHub issues, PR descriptions, or docs. Annotations rendered as inline images (base64 data URIs of the canvas snapshot).
  3. MCP-compatible — structured as an MCP resource or tool response, so coding tools that speak MCP can consume captures directly.

Design:
The formatter should become a strategy pattern:

```typescript
interface OutputFormatter {
format(session: CaptureSession): string;
mimeType: string;
label: string; // shown in sidepanel dropdown
}
```

The sidepanel gets a format selector dropdown. Default remains plain text for backward compatibility.

Implementation notes:

  • JSON schema should be versioned (`"version": 1`) so consumers can handle format evolution
  • Markdown format needs to handle missing fields gracefully (no component info? skip that section)
  • MCP format depends on the MCP spec stabilizing — may want to defer that variant

Related to NLnet milestone M6 (output formats and integrations).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1-criticalMust-have for NLnet submission or core functionalityarchitectureArchitectural changes or decisionsenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions