Skip to content

Add database-driven Templates admin with chain template support#36

Open
zhiganov wants to merge 4 commits intomasterfrom
feature/admin-templates
Open

Add database-driven Templates admin with chain template support#36
zhiganov wants to merge 4 commits intomasterfrom
feature/admin-templates

Conversation

@zhiganov
Copy link
Member

@zhiganov zhiganov commented Feb 7, 2026

Summary

  • Port templates management from Pro to OSS admin panel at /admin/templates
  • Add chain template support for multi-session sequences (e.g. Wardley Mapping)
  • Each chain step has its own facilitation prompt, session name, and context injection rules
  • Context modes: none, previous_summary, all_summaries, custom (with template variables)

Changes

Database

  • templates table already exists from Pro — no migration needed
  • Added template_type (text, default 'single') and chain_config (jsonb) columns via direct SQL

Backend

  • src/lib/schema.ts — Added TemplatesTable with template_type and chain_config fields
  • src/lib/db.ts — 5 CRUD functions: getTemplates, getTemplateById, createTemplate, updateTemplate, deleteTemplate
  • src/app/api/admin/templates/ — GET/POST/PUT/DELETE API routes handling chain fields

Frontend

  • src/app/admin/templates/types.ts — ChainStep, ChainConfig, Template interfaces
  • src/app/admin/templates/page.tsx — Full redesign with:
    • Card grid list view (replaces basic table)
    • Tab filters: All / Single / Chain
    • Single template CRUD via dialogs
    • Chain template editor with vertical pipeline visualization
    • Step management: add, remove, reorder, expand/collapse
    • Context injection UI with mode selector and variable chips
  • src/app/admin/Sidebar.tsx — Templates nav link
  • src/app/create/choose-template.tsx — Fetch from API instead of static JSON

Test plan

  • Visit /admin/templates — existing 9 templates show as "Single" type in card grid
  • Create a new single template — same flow as before
  • Create a new chain template with 3 steps, each with different context modes
  • Edit chain — verify steps persist, reorder works, context templates save
  • Delete a template — verify both single and chain deletion works
  • Tab filters work correctly (All/Single/Chain)
  • npx tsc --noEmit passes clean

🤖 Generated with Claude Code

zhiganov and others added 2 commits February 3, 2026 21:41
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Port templates from static JSON to a database-backed system with full CRUD
admin UI at /admin/templates. Templates are seeded from the existing 9
templates.json entries. The /create flow now fetches templates from the API
instead of importing the static file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
harmonica-web-app Ready Ready Preview, Comment Feb 7, 2026 0:34am
harmonica-web-app-dev Ready Ready Preview, Comment Feb 7, 2026 0:34am

Request Review

The OSS and Pro repos share the same Neon database. Pro's migration
033_20251218_add_templates_table already created the table and seeded
the 9 templates. No migration needed on the OSS side.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add multi-session chain template management to the admin UI.
Chain templates define a sequence of sessions where results from
session N inform the context of session N+1 via configurable
context injection modes (none, previous_summary, all_summaries, custom).

- Add template_type and chain_config fields to schema
- Create types.ts with ChainStep, ChainConfig interfaces
- Update API routes to handle chain fields
- Rewrite page.tsx with card grid, tab filters, and vertical
  pipeline editor for chain template step management

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zhiganov zhiganov changed the title Add database-driven Templates admin panel Add database-driven Templates admin with chain template support Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant