Skip to content

previewsmcp init — scaffold project config and setup plugin #87

@obj-p

Description

@obj-p

Problem

Setting up PreviewsMCP for a project requires manual boilerplate:

  1. Creating a .previewsmcp.json with platform, device, and trait defaults
  2. For the setup plugin: creating a PreviewSetup/ package directory, Package.swift with the PreviewsSetupKit dependency, and a PreviewSetup protocol stub
  3. Wiring the setup block in .previewsmcp.json

This is error-prone and not discoverable from the CLI alone.

Proposal

Add a previewsmcp init subcommand that scaffolds project configuration interactively or with flags:

# Scaffold .previewsmcp.json with auto-detected defaults
previewsmcp init

# Also generate the setup plugin package
previewsmcp init --setup

# Non-interactive with explicit values
previewsmcp init --platform ios --device "iPhone 16 Pro" --setup

What init generates

Always:

With --setup:

  • PreviewSetup/Package.swift with PreviewsSetupKit dependency
  • PreviewSetup/Sources/<ModuleName>/Setup.swift with a PreviewSetup protocol stub
  • Adds the setup block to .previewsmcp.json

Considerations

  • Should not overwrite existing files without --force
  • Module name and type name could be prompted interactively or accept --module-name / --type-name flags
  • Could detect existing .previewsmcp.json and offer to add missing fields (e.g., add setup to an existing config)
  • See docs/setup-plugin.md for the full integration walkthrough

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions