Commit 2bc4109
feat: Add Template Library (#278)
* feat: Add Template Library functionality
- Add comprehensive template library for workflow templates
- Support publishing workflows as templates with GitHub integration
- Allow users to browse and use existing templates
- Include template submission workflow with pull request generation
- Add frontend UI for template discovery and usage
- Add database schema for templates and submissions
- Implement GitHub template service for fetching templates
- Add workflow sanitization service to remove sensitive data
- Include TypeScript type definitions and error handling
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: Resolve ESLint/Prettier formatting issues in Template Library
- Change Array<T> to T[] in templateStore.ts
- Fix Select component props formatting in TemplateLibraryPage
- Fix Button onClick callback formatting
- Fix fetch call and .json() chaining formatting
- Fix Publish as Template text wrapping in TopBar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: Resolve ESLint/Prettier formatting issues in backend templates
- Change Array<T> to T[] throughout template files
- Fix import statement formatting
- Fix query chain formatting in repository
- Fix unused variables by prefixing with underscore
- Fix object literal formatting and error logging
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: Temporarily disable Templates module due to Bun+NestJS compatibility issue
The TemplatesModule causes a "function is not a constructor" error when loaded
by NestJS in the Bun runtime. This is a known Bun+NestJS compatibility issue
(see oven-sh/bun#4858).
Changes:
- Added forwardRef for WorkflowsModule import (good practice regardless)
- Added comments documenting the temporary disable
- Removed TemplatesModule from app.module.ts coreModules array
The backend now starts successfully. The template library feature will be
unavailable until this compatibility issue is resolved.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: Refactor Template Library to use GitHub web flow
This commit refactors the Template Library to use GitHub's web flow
for publishing instead of Octokit API, and fixes Bun+NestJS compatibility
issues.
Changes:
- Frontend now generates GitHub URLs directly for template submission
- Added GitHub sync service to fetch templates from repository
- Made template listing endpoints public for browsing
- Fixed Bun+NestJS constructor error by removing duplicate providers
- Replaced RequireWorkflowRole with RolesGuard to avoid module dependencies
- Added better PR creation instructions in the publish modal
- Removed Octokit dependency and token from backend
Users can now:
1. Publish workflows as templates via GitHub PR flow
2. Browse templates from the library (after sync from GitHub)
3. Sync templates from GitHub repo to database via admin endpoint
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: Add GitHub webhook endpoint for automatic template sync
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: Add GITHUB_WEBHOOK_SECRET env var placeholder
This is required for webhook signature verification.
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: Remove dead syncTemplates method from TemplateService
The sync is now handled directly by GitHubSyncService in the
controller. This removes confusing dead code that returned a
"disabled" message.
Also fixes ESLint errors for unused parameters.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: Simplify template sync to startup-only with rate limit handling
- Remove webhook controller and token auth (repo is public)
- Remove periodic sync interval to avoid GitHub rate limit exhaustion
- Add graceful 403 rate limit handling in GitHub API calls
- Fix findAll() query composition bug using and() pattern
- Add tag filtering, ILIKE escaping, and proper sort ordering
- Add ARCHITECTURE.md documenting the template library system
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: Resolve lint and prettier formatting errors in frontend templates
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: Use clipboard instead of URL for template content to avoid GitHub URL length limit
Large workflow graphs were causing "URL is too long" errors on GitHub.
Now copies template JSON to clipboard and instructs user to paste it
in the GitHub editor.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: Fix template sync validation and improve publish UX
Backend: Remove mandatory `manifest` field check - actual templates
only have `_metadata`, `graph`, and `requiredSecrets`. Build manifest
from `_metadata` for DB storage.
Frontend: Strip viewport/position data from graph to reduce URL size.
Embed template content in GitHub URL when it fits (<7.5KB), fall back
to clipboard with paste instructions only for very large templates.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: Implement Use Template, fix publish UX, fix card layout
- Implement useTemplate endpoint: creates a real workflow from template
graph via WorkflowsService, increments popularity counter
- Publish flow: use minified JSON + stripped layout data to always
embed content in GitHub URL (no clipboard fallback)
- Template cards: fix inconsistent button positioning with flex layout
so buttons are always pinned to the bottom of each card
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: Fix Use Template redirect, restore JSON formatting, add GitHub token support
- Fix workflowId undefined in redirect by mapping backend response
(workflow.id → workflowId) in templateStore
- Restore pretty-printed JSON (2-space indent) in publish flow so
GitHub renders syntax highlighting correctly
- Add optional GITHUB_TEMPLATE_TOKEN env var for authenticated API
requests (60 → 5000 req/hr) with startup log showing auth status
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: Add ETag conditional requests and fix missing node positions
- Implement ETag-based caching in GitHub sync service: stores ETags
per URL, sends If-None-Match on subsequent requests, returns cached
data on 304 Not Modified (zero rate limit cost)
- Fix Use Template 500 error caused by missing node positions: add
default grid layout positions for nodes that lack them before
WorkflowGraphSchema validation
- Stop stripping node positions during publish (required by schema),
only strip viewport which has a schema default
- Sync response now includes unchanged[] and directoryCacheHit stats
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: use clipboard copy-paste for GitHub webflow to avoid long URL errors
Template content is no longer embedded in the GitHub URL params, which
caused browser URL length limit errors for large workflows. Instead,
the code is auto-copied to clipboard and users paste it in the GitHub
editor. A "Copy Template Code" button is shown in the success state
for re-copying.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix(test): mock IsolatedContainerVolume in naabu tests
Tests were failing because IsolatedContainerVolume tried to create
real Docker volumes. Mock the volume class so tests don't require
a running Docker daemon.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: add explanatory note for GitHub PR workflow in publish modal
Clarify that templates are submitted via GitHub pull requests and
that users need to paste the copied code into the GitHub editor.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: add GITHUB_TEMPLATE_* env vars to backend validation schema
Add Zod validation for GITHUB_TEMPLATE_REPO (owner/repo format),
GITHUB_TEMPLATE_BRANCH, and GITHUB_TEMPLATE_TOKEN to catch
misconfiguration at startup instead of silent runtime failures.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: add workflow preview thumbnails and revamp template library UI
- Add inline SVG workflow graph previews on template cards
- Cursor-based zoom with scroll wheel and transform-origin tracking
- Category-themed gradients, icons, and color-coded badges
- Improved card design with hover animations and better layout
- Better loading skeletons, empty state, and error handling
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: improve workflow preview thumbnails and UI polish
- Card-style nodes with header band, icon, label, subtitle, port dots
- Wider nodes (160px) matching real builder proportions
- Stronger shadows and contrast for dark/light mode visibility
- Add "scroll to zoom" hint on hover
- Indent tag filter row for alignment
- Better edge styling with thicker arrows
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: improve template library UI, add JSONC support, and consolidate navbar actions
- Template cards: display tags and author metadata side by side
- JSONC support: publish templates as .jsonc, backend strips comments
before parsing, sync accepts both .json and .jsonc files
- GitHub publish flow: pre-fill editor with placeholder comment
- Navbar: consolidate undo/redo/import/export into vertical three-dots
menu to the right of the Run button
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: redesign template cards with premium marketplace styling
Implements detailed design spec with rounded-2xl cards, theme-specific
preview gradients, author avatars, title case names, marketplace metadata
(stars, secrets, updated time), full-width indigo CTA with arrow animation,
eye preview button with tooltip, and tag overflow tooltip.
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: add automatic GitHub template sync every 30 minutes
Replaces manual-only sync with a recurring setInterval that syncs
templates from GitHub every 30 minutes. ETag caching ensures minimal
API cost when nothing has changed. Cleans up interval on module destroy.
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: use primary color for CTA button and deduplicate category from tags
Switch "Use Template" button from hardcoded indigo to the codebase's
primary color token. Filter out the category name from the tags list
so it doesn't appear redundantly in both the badge and tags row.
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* feat: add template detail modal and move page title to navbar
Add click-to-preview modal on template cards showing large graph,
full title/description, and Use Template CTA. Move page title to
AppTopBar navbar and remove in-page header to match Schedules layout.
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: address code review findings for template library
- Sanitize {{secret:SECRET_ID}} references in publish validation (#1)
- Migrate UseTemplateModal from Zustand to TanStack Query mutation (#2)
- Reset modal state on template/open change to prevent stale data (#3)
- Fetch GitHub repo config dynamically with fallback defaults (#4)
- Use snake_case keys for analytics event properties (#5)
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
* fix: there were multiple bugs after reviewing like secret mapping ,env fixed them.
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
---------
Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>1 parent 9213d5c commit 2bc4109
34 files changed
Lines changed: 5190 additions & 153 deletions
File tree
- .github/workflows
- backend
- drizzle
- src
- config
- database/schema
- templates
- docs
- frontend
- src
- components/layout
- features
- analytics
- templates
- workflow-builder
- hooks
- queries
- lib
- pages
- services
- types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
78 | 89 | | |
79 | 90 | | |
80 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
0 commit comments