Skip to content

Conversation

@betterclever
Copy link
Contributor

Summary

Enhanced report template editor with AI-powered template generation and editing capabilities.

Features

  • Template Editor UI: Full-featured editor with live preview, schema/data panels
  • AI Assistant: Integrated AI chat for generating and modifying templates
  • Step-by-step Undo: AI changes push checkpoints to undo stack for granular restoration
  • Smart Save Button: Workflow-style save button with dirty state tracking and sync status
  • Layout: Schema/Data on left, Preview center, AI Assistant on right

Changes

  • frontend/src/pages/TemplateEditor.tsx: Main template editor with live preview
  • frontend/src/components/ai/TemplateChat.tsx: AI chat component with undo functionality
  • frontend/src/store/templateStore.ts: Added dirty state tracking
  • frontend/src/pages/TemplatesPage.tsx: Simplified template creation flow

Testing

  • Template creation and editing flows verified
  • Save button with dirty state working correctly
  • AI undo stack functioning as expected

Next Steps

  • Report generator component to consume these templates
  • Additional template customization options

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@betterclever betterclever changed the base branch from main to structured-output January 1, 2026 16:05
@betterclever betterclever changed the base branch from structured-output to betterclever/subworkflow January 1, 2026 16:05
@betterclever betterclever force-pushed the betterclever/subworkflow branch from 5f030c1 to 43dc952 Compare January 1, 2026 16:33
@betterclever betterclever changed the base branch from betterclever/subworkflow to main January 1, 2026 16:39
@betterclever betterclever force-pushed the betterclever/report-generation branch from 966544a to a4495e7 Compare January 1, 2026 17:05
betterclever and others added 24 commits January 1, 2026 22:35
…spec

Add detailed specification for the report generation feature including:
- Architecture overview with AI-assisted template creation
- 5-phase implementation plan
- Database schema for templates and generated reports
- Component contract for core.report.generator
- UI layouts for template list, editor, and workflow integration

This addresses issue #21 for implementing a drag-and-drop reporting component
that generates client-ready security reports from workflow outputs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Implement Phase 1 of the report generation feature:

- Add core.report.generator component with HTML/PDF output support
- Define finding, metadata, and scope schemas for security reports
- Include default ShipSec branding (header/footer)
- Generate severity-coded findings tables with CVSS/CVE support
- Add comprehensive test suite (19 passing, 1 minor mock issue)
- Export getDefaultReportHTML, SEVERITY_COLORS, SHIPSEC_BRANDING

The component generates HTML reports with:
- Executive summary with severity breakdown
- Detailed findings with color-coded severity badges
- Scope/targets table
- Methodology section

TODO:
- Integrate with Puppeteer component for PDF generation
- Add template database schema (Phase 2)
- Build template editor UI (Phase 3)
- Add Preact+HTM template rendering (Phase 4)

Resolves part of #21

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Phase 1: core.report.generator component with custom template rendering
- Phase 2: Database schema (report_templates, generated_reports tables)
- Phase 3: Template editor UI with AI Elements chat integration
- Phase 4: Custom template renderer with 4 standard templates

AI SDK Integration:
- Added official Vercel AI Elements components via shadcn CLI
- useChat hook for streaming chat with thinking states
- AI template generation endpoints (streaming + structured)
- Full chat UI with message bubbles, reasoning, prompt input

Files:
- backend/: migrations, ORM schema, API endpoints, DTOs
- frontend/: TemplatesPage, TemplateEditor, TemplateChat, AI Elements
- worker/: renderer.ts, templates.ts, report-generator.ts

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Fix duplicate /api/v1/ prefix in controller routes
- Add @ai-sdk/openai dependency to backend
- Fix z.record(z.unknown()) compatibility issue with nestjs-zod
- Regenerate openapi.json with correct template endpoints

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Mark OpenAPI spec generation as complete
- Update remaining work section
- Clean up completed items from todo list

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Fixed portUtils.ts to handle undefined dataType values with optional chaining
- Fixed workflow-call.ts to use port helpers directly instead of accessing non-existent .dataType property
- Cleaned up ParameterField.tsx to remove unnecessary any casts when accessing runtimeInputs

This fixes the 'unknown' type display for Call Workflow input/output ports.

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Upgrade @ai-sdk/react to 3.0.5
- Refactor TemplateChat to use DefaultChatTransport and UIMessage.parts
- Fix usage of .at() in prompt-input.tsx
- Add icon-sm button variant
- Update documentation

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…actions

- Frontend: Refactored TemplateEditor to use iframe srcDoc with Preact/HTM for zero-latency local previews.
- Frontend: Updated TemplateChat to handle tool streaming, reasoning parts, and correct tool result acknowledgement.
- Backend: Updated AI system prompt to generate compliant Preact+HTM code without imports/exports.
- Backend: Configured update_template tool with proper schema.
- Cleanup: Moved debug scripts to debug/ folder.

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…imize Kafka startup

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…son parsing

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Sidebar collapsed by default (like Workflow Editor)
- Added toggle button to show/hide sidebar panel
- Moved template name, version, and save button to preview header
- Removed separate header row to save vertical space
- Compact preview controls with zoom and refresh buttons

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Added proper app title bar at the top (like Workflow Editor)
- Template name, version badge, and Save button in top bar
- Sidebar always visible for editing (no toggle)
- Preview area has simple header with zoom/refresh controls
- Clean layout structure matching the app patterns

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- AppLayout now auto-collapses main nav sidebar for template editor routes
- AppTopBar hidden for template editor (uses its own TopBar)
- Template Editor has proper top bar with back button, name, version, save
- Left sidebar (Sample Data/Schema + AI) always visible
- Right panel is Preview area
- Pattern matches Workflow Editor behavior

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Added height: 100% and overflow: hidden to html, body, and #root
- Added margin: 0, padding: 0 to body for reset
- App now behaves like a proper SPA without page-level scrolling

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Removed redundant code blocks showing template, schema, and sample data
- Now just shows a compact 'Updated template, schema, sample data' indicator
- The actual data is already visible in the sidebar tabs
- Removed unused CodeBlock imports

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Reduced font sizes: labels 0.65rem, inputs 0.7rem, buttons 0.65rem
- Smaller input heights and padding
- Reduced spacing between form groups
- Compact checkboxes, buttons, and icons
- Tighter fieldset/legend padding
- All elements scoped to .schematic-form-compact class

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…dering and visible controls

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…to RJSF theme v1

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…nitial state generation instructions

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
… state

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…ng' and 'Working' based on progress

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…a generation

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…en when label is hidden

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…- Config)

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…lexbox structure

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…ate render errors

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
… stats

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…ng on template cards

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…plate editor

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…n dialog

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
…d call

- Remove entire /worker/src/components/report/ directory
- Fix TypeScript errors by adding missing startChild call in workflows/index.ts
- Remove failing report generator tests (6 tests removed)
- Update component imports to exclude report generator

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Remove AI Generation E2E Tests section from report-templates.test.ts
- Keep report template CRUD tests intact
- Update file description to remove AI references
- AI functionality can be tested separately when implemented

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
- Remove .ai/report-generation.md
- Remove .ai/report-generation-layout.txt
- Clean up feature documentation since component was removed

Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
@betterclever betterclever force-pushed the betterclever/report-generation branch from a4495e7 to 4a265c6 Compare January 1, 2026 17:05
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.

2 participants