Problem
Setting up PreviewsMCP for a project requires manual boilerplate:
- Creating a
.previewsmcp.json with platform, device, and trait defaults
- For the setup plugin: creating a
PreviewSetup/ package directory, Package.swift with the PreviewsSetupKit dependency, and a PreviewSetup protocol stub
- 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
Problem
Setting up PreviewsMCP for a project requires manual boilerplate:
.previewsmcp.jsonwith platform, device, and trait defaultsPreviewSetup/package directory,Package.swiftwith thePreviewsSetupKitdependency, and aPreviewSetupprotocol stubsetupblock in.previewsmcp.jsonThis is error-prone and not discoverable from the CLI alone.
Proposal
Add a
previewsmcp initsubcommand that scaffolds project configuration interactively or with flags:What
initgeneratesAlways:
.previewsmcp.jsonwith sensible defaults (auto-detect platform from project if possible, per Auto-detect platform from project instead of defaulting to macOS #83)With
--setup:PreviewSetup/Package.swiftwithPreviewsSetupKitdependencyPreviewSetup/Sources/<ModuleName>/Setup.swiftwith aPreviewSetupprotocol stubsetupblock to.previewsmcp.jsonConsiderations
--force--module-name/--type-nameflags.previewsmcp.jsonand offer to add missing fields (e.g., addsetupto an existing config)docs/setup-plugin.mdfor the full integration walkthrough