Draft
Conversation
This adds a new 'knock workflow preview' command that starts a local preview server for workflow templates. Features: - Express server on port 3004 with React SPA (built with Vite) - Uses Telegraph design system components for the UI - Combobox to select channel steps within a workflow - Real-time preview using Knock's template preview API - Editable preview context: recipient, actor, tenant, and trigger data - File watcher with debounced auto-reload on changes - WebSocket for live reload notifications - Email-specific features: - Toggle between HTML and plain text preview - Responsive preview modes (desktop, tablet, mobile) - Layout resolution for email templates - Support for all channel types (email, SMS, push, chat, in-app feed) - JSON schema integration for generating sample trigger data - Optional --data-file flag to load sample data from file Architecture: - src/commands/workflow/preview.ts - CLI command entry point - src/lib/preview-server/ - Express server and API routes - src/lib/preview-server/client/ - React SPA source - dist/preview-client/ - Built SPA (created during build) Co-authored-by: chris <chris@knock.app>
|
Cursor Agent can help with this pull request. Just |
Co-authored-by: chris <chris@knock.app>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new
knock workflow preview {workflow-key}command, enabling developers to locally preview and edit their workflow templates in a browser. This feature significantly enhances the template development experience by providing:The implementation involves:
chokidar) with debouncing to trigger live reloads on template file changes./v1/templates/previewendpoint, sending local template content, resolved layouts, and partials.Todos
Tasks
Screenshots