Skip to content

Conversation

@seanspeaks
Copy link
Contributor

@seanspeaks seanspeaks commented Dec 20, 2025

Summary

This PR includes significant enhancements to the Management UI and Frigg CLI:

Management UI

  • OAuth Credentials Prompt: Auto-detect missing OAuth credentials and prompt for configuration
  • Shared Secret Proxy: User simulation for local testing without full auth
  • Auto-connect: Retry connection when repository path becomes available
  • Frigg App Connection: Connect to running Frigg apps with AI chat integration
  • DDD Refactoring: Clean architecture with use cases, adapters, and controllers

Frigg CLI

  • API Module Validation: Validate module definitions against JSON Schema
  • PostgreSQL Migration Check: Pre-flight check for Prisma migrations on frigg start
  • Inquirer Fixes: Fix prompts and deprecate create-frigg-app
  • Validate Command: Consolidated with @friggframework/schemas

Core

  • Options Class: Improved robustness with comprehensive tests
  • Process Repository Export: Export createProcessRepository for process tracking

Documentation

  • ADR-006: Integration Router v2
  • ADR-007: Management UI Architecture
  • ADR-008: Frigg CLI Start Command
  • ADR-009: E2E Test Package Architecture
  • Integration Patterns Guide

Test Plan

  • Unit tests for OAuth credentials use cases (99 tests passing)
  • Management UI server tests
  • CLI validation tests
  • Manual testing of OAuth credential flow
  • E2E testing with linked Frigg apps

🤖 Generated with Claude Code

📦 Published PR as canary version: 2.0.0--canary.522.cbd3d5a.0

✨ Test out this PR locally via:

npm install @friggframework/admin-scripts@2.0.0--canary.522.cbd3d5a.0
npm install @friggframework/ai-agents@2.0.0--canary.522.cbd3d5a.0
npm install @friggframework/core@2.0.0--canary.522.cbd3d5a.0
npm install @friggframework/devtools@2.0.0--canary.522.cbd3d5a.0
npm install @friggframework/e2e@2.0.0--canary.522.cbd3d5a.0
npm install @friggframework/eslint-config@2.0.0--canary.522.cbd3d5a.0
npm install @friggframework/prettier-config@2.0.0--canary.522.cbd3d5a.0
npm install @friggframework/schemas@2.0.0--canary.522.cbd3d5a.0
npm install @friggframework/serverless-plugin@2.0.0--canary.522.cbd3d5a.0
npm install @friggframework/test@2.0.0--canary.522.cbd3d5a.0
npm install @friggframework/ui@2.0.0--canary.522.cbd3d5a.0
# or 
yarn add @friggframework/admin-scripts@2.0.0--canary.522.cbd3d5a.0
yarn add @friggframework/ai-agents@2.0.0--canary.522.cbd3d5a.0
yarn add @friggframework/core@2.0.0--canary.522.cbd3d5a.0
yarn add @friggframework/devtools@2.0.0--canary.522.cbd3d5a.0
yarn add @friggframework/e2e@2.0.0--canary.522.cbd3d5a.0
yarn add @friggframework/eslint-config@2.0.0--canary.522.cbd3d5a.0
yarn add @friggframework/prettier-config@2.0.0--canary.522.cbd3d5a.0
yarn add @friggframework/schemas@2.0.0--canary.522.cbd3d5a.0
yarn add @friggframework/serverless-plugin@2.0.0--canary.522.cbd3d5a.0
yarn add @friggframework/test@2.0.0--canary.522.cbd3d5a.0
yarn add @friggframework/ui@2.0.0--canary.522.cbd3d5a.0

seanspeaks and others added 30 commits October 2, 2025 19:10
- Add loadUser middleware using GetUserFromBearerToken use case
- Add requireLoggedInUser middleware for protected routes
- Integrate with NEW TokenRepository (Prisma-based)
- Remove OLD Mongoose Token/State models (replaced by Prisma)
- Follow DDD architecture: Handlers → Use Cases → Repositories
…cture

BREAKING CHANGE: Replaced use-case and repository patterns with simplified factory approach

- Add create-frigg-backend.js for backend initialization
- Add integration-factory.js for dynamic integration loading
- Add integration-mapping.js for integration type registry
- Add integration-model.js for Mongoose schema
- Add integration-user.js for user-integration associations
- Refactor module-plugin with auther, entity-manager, manager classes
- Update integration router with cleaner API separation
- Add admin routes with requireAdmin middleware
- Add integration base test file
- Update auth and user routers for new architecture
- Update package.json with new dependencies
Replace OLD factory pattern with NEW DDD/hexagonal architecture patterns
from feat/general-code-improvements base branch.

BREAKING CHANGE: Replaces factory approach with use-case/repository patterns

Changes:
- Replace IntegrationFactory with use case classes (CreateIntegration,
  GetIntegrationsForUser, DeleteIntegrationForUser, etc.)
- Replace ModuleFactory (module-plugin) with ModuleFactory (modules)
- Restore integration-router.js to use NEW DDD architecture with
  dependency injection and use cases
- Restore integration-base.js to use repositories and use cases
- Remove OLD factory files: integration-factory.js, integration-model.js,
  integration-user.js, integration-mapping.js, create-frigg-backend.js
- Remove OLD module-plugin files: auther.js, entity-manager.js, manager.js,
  module-factory.js
- Update index.js exports to export NEW DDD components (repositories,
  use cases, command factories)
- Update backend-utils.js to use IntegrationEventDispatcher
- Update auth.js to use simplified NEW pattern

Stack 2 now properly builds on the DDD/hexagonal architecture
from the base branch instead of introducing the OLD factory pattern.

🤖 Generated with Claude Code
Port NEW business logic from original Stack 2 commit to DDD/hexagonal
architecture while maintaining use cases and repositories pattern.

Changes:
- Add admin router (admin.js) with DDD-compatible user and global entity
  management endpoints using user and module repositories
- Add requireAdmin middleware for admin API key authentication
- Add integration settings endpoint to auth.js (/config/integration-settings)
- Add RESTful /users endpoints to user.js (POST /users, POST /users/login)
  using LoginUser, CreateIndividualUser, and CreateTokenForUserId use cases
- Port Global Entities feature to CreateIntegration use case:
  * Auto-include global entities marked with `global: true` in integration
    Definition.entities
  * Find and attach global entities using module repository
  * Throw error if required global entity is missing

Admin Endpoints:
- GET /api/admin/users - List all users with pagination
- GET /api/admin/users/search - Search users by username/email
- GET /api/admin/users/:userId - Get specific user
- GET /api/admin/entities - List all global entities
- GET /api/admin/entities/:entityId - Get specific global entity
- POST /api/admin/entities - Create global entity
- PUT /api/admin/entities/:entityId - Update global entity
- DELETE /api/admin/entities/:entityId - Delete global entity
- POST /api/admin/entities/:entityId/test - Test global entity connection

All NEW functionality uses proper DDD patterns:
- Handlers call use cases (not repositories directly)
- Use cases contain business logic and orchestration
- Repositories handle data access
- Dependency injection throughout

🤖 Generated with Claude Code
Implements clean architecture with domain, application, infrastructure, and presentation layers

Domain Layer:
- Entities: Project, Integration, APIModule, Connection, GitRepository, GitBranch, AppDefinition
- Value Objects: ProjectId, ProjectStatus, IntegrationStatus, ConnectionStatus, Credentials
- Services: GitService, ProcessManager, BackendDefinitionService
- Errors: EntityValidationError, ProcessConflictError

Application Layer:
- Services: ProjectService, IntegrationService, APIModuleService, GitService
- Use Cases: 18 use cases covering project management, integrations, git operations

Infrastructure Layer:
- Adapters: FriggCliAdapter, GitAdapter, ProcessManager, ConfigValidator
- Repositories: FileSystemProjectRepository, FileSystemIntegrationRepository, FileSystemAPIModuleRepository
- Persistence: SimpleGitAdapter

Presentation Layer:
- Controllers: ProjectController, IntegrationController, APIModuleController, GitController
- Routes: projectRoutes, integrationRoutes, apiModuleRoutes, gitRoutes, testAreaRoutes

Dependency Injection:
- container.js for DI configuration
- app.js for Express app initialization

Documentation:
- Complete architecture documentation
- API structure guide
- Holistic DDD architecture overview
Implements clean architecture with domain, application, infrastructure, and presentation layers

Domain Layer:
- Entities: User, AdminUser, Project, Integration, APIModule, Environment, GlobalEntity
- Interfaces: Repository interfaces, SocketService interface
- Value Objects: IntegrationStatus, ServiceStatus

Application Layer:
- Services: UserService, AdminService, ProjectService, IntegrationService, EnvironmentService
- Use Cases: GetProjectStatus, InstallIntegration, ListIntegrations, StartProject, StopProject, SwitchRepository

Infrastructure Layer:
- Adapters: Repository adapters for all domains, SocketServiceAdapter
- HTTP Client: api-client.js with request/response handling
- WebSocket: websocket-handlers.js for real-time updates
- NPM Registry: npm-registry-client.js for package management

Presentation Layer:
- App: Main App.jsx with routing
- Components:
  * Admin: AdminViewContainer, UserManagement, GlobalEntityManagement, CreateUserModal
  * Common: IDESelector, LiveLogPanel, OpenInIDEButton, RepositoryPicker, SearchBar, SettingsButton, SettingsModal, ZoneNavigation
  * Integrations: IntegrationGallery
  * Layout: AppRouter, ErrorBoundary, Layout
  * Theme: ThemeProvider
  * UI: badge, button, card, dialog, dropdown-menu, input, select, skeleton
  * Zones: DefinitionsZone, TestAreaContainer, TestAreaUserSelection, TestAreaWelcome, TestingZone
- Hooks: useFrigg, useIDE, useIntegrations, useRepositories, useSocket
- Pages: Settings

Dependency Injection:
- container.js for client-side DI configuration
- main.jsx as application entry point
Migration:
- Add Jest configuration for server and client testing
- Configure Jest for ESM and Node environment
- Add test setup files for both server and client

Server Tests (13 files):
- Unit tests: ProjectController, GitService, ProcessManager, StartProjectUseCase
- Integration tests: Project endpoints end-to-end flow
- API tests: Connections, integrations, project endpoints
- Test environment configuration and setup utilities

Client Tests (34 files):
- Component tests: OpenInIDEButton, SettingsModal, TestAreaContainer, ThemeProvider, ZoneNavigation, button
- Integration tests: Complete workflow, zone navigation flow, DDD end-to-end flow
- Domain tests: Integration, Project entities, AdminUser, GlobalEntity
- Application tests: IntegrationService, ProjectService, AdminService
- Infrastructure tests: Repository adapters, container, performance
- Hook tests: useFrigg zones, useIDE
- Specialized tests:
  * Accessibility: Component accessibility testing
  * Security: Security vulnerability testing
  * Responsive: Viewport and responsive design tests
  * Edge cases: Browser compatibility testing

Test Infrastructure:
- test-runner.js: Coordinated test execution across suites
- testHelpers.js: Shared testing utilities and fixtures
- setup.js: Test environment configuration
- mocks/ideApi.js: IDE integration API mocking
- README.md: Test strategy and organization documentation
- legacy-cleanup-analysis.md: Analysis of legacy test cleanup

Configuration:
- server/jest.config.js: Server-side Jest configuration
- server/tests/.env.test: Test environment variables
- src/test/setup.js: Client test setup (Vitest compatibility)
- src/tests/setup.js: Jest test setup
Domain Layer:
- Entities: Integration, Entity, IntegrationOption
- Domain models with business logic and validation
- Domain index for centralized exports

Application Layer:
- Services: IntegrationService, EntityService for business orchestration
- Use Cases: InstallIntegrationUseCase, SelectEntitiesUseCase, ConnectEntityUseCase
- Application index for use case exports

Infrastructure Layer:
- Adapters: IntegrationRepositoryAdapter, EntityRepositoryAdapter, FriggApiAdapter
- Storage: OAuthStateStorage for OAuth flow state management
- Infrastructure index for adapter exports

Presentation Layer:
- Hooks: useIntegrationLogic for business logic encapsulation
- Layouts: IntegrationHorizontalLayout, IntegrationVerticalLayout for display separation

Testing:
- Domain tests: Entity, Integration, IntegrationOption
- Application tests: InstallIntegrationUseCase, SelectEntitiesUseCase
- Infrastructure tests: OAuthStateStorage

Enhancements:
- Update API client with better error handling and request management
- Export new DDD components from integration index
- Separate business logic from presentation components
- Implement repository pattern for data access abstraction
Installation Wizard:
- InstallationWizardModal: Main orchestrator for multi-step installation flow
- EntityConnectionModal: Modal for connecting/creating entities
- EntitySelector: Component for selecting entities during setup
- EntityCard: Reusable card component for entity display
- IntegrationCard: Card component for integration display
- RedirectHandler: OAuth redirect handling component

Entity Management:
- EntityManager: Comprehensive CRUD operations for entities
- IntegrationBuilder: Build and configure integration definitions

Documentation:
- INSTALLATION_WIZARD_IMPLEMENTATION.md: Complete implementation guide

Integration:
- Wire wizard to DDD use cases and services
- Implement step-by-step installation process
- Handle OAuth flows and entity selection
- Support both horizontal and vertical layout integration
…ation

CLI Specifications:
- CLI_SPECIFICATION.md: Complete CLI command structure and API reference
- CLI_DDD_ARCHITECTURE.md: Domain-driven design architecture for CLI
- CLI_CREATE_COMMANDS_SPEC.md: Detailed `frigg create` command specifications
- CLI_FILE_OPERATIONS_SPEC.md: File operation patterns and best practices
- CLI_GIT_INTEGRATION_SPEC.md: Git workflow integration specifications
- CLI_GIT_SAFETY_SPEC.md: Git safety protocols and conflict resolution
- CLI_IMPLEMENTATION_ROADMAP.md: Implementation phases and milestones

CLI Updates:
- Update ui-command/index.js with improved command handling
- Update infrastructure creation utilities with better error handling

Management-UI Documentation:
- PRD.md: Product requirements document with feature specifications
- FIXES_APPLIED.md: Comprehensive fix documentation and change log
- RELOAD_FIX.md: Hot reload fix documentation and troubleshooting
- TDD_IMPLEMENTATION_SUMMARY.md: Test-driven development implementation summary

Archived Documentation:
- API.md: Legacy API documentation (archived)
- DDD_REFACTOR_PLAN.md: Original DDD refactoring plan (archived)
- DDD_VALIDATION_REPORT.md: DDD implementation validation (archived)
- LEARNINGS_SERVERLESS_ROUTES.md: Serverless routing learnings (archived)
- PRD_PROGRESS.md: Historical PRD progress tracking (archived)
- TESTING_REPORT.md: Original testing report (archived)
Domain Layer:
- Entities: ApiModule, AppDefinition, Integration
- Value Objects: SemanticVersion, IntegrationName, IntegrationStatus
- Exceptions: DomainException for domain rule violations
- Ports: Repository interfaces for dependency inversion

Application Layer:
- Use Cases: CreateIntegrationUseCase, CreateApiModuleUseCase, AddApiModuleToIntegrationUseCase
- Command orchestration for CLI operations
- Business logic for integration and API module management

Infrastructure Layer:
- Repositories: FileSystemAppDefinitionRepository, FileSystemIntegrationRepository, FileSystemApiModuleRepository
- Adapters: IntegrationJsUpdater for code file modifications
- File system operations and persistence

Dependency Injection:
- container.js: DI configuration for CLI components
- Wires use cases with repositories and adapters

Testing:
- Domain tests: ApiModule, AppDefinition, IntegrationName, IntegrationValidator
- Application tests: Use case testing with mocks
- Infrastructure tests: Repository and adapter testing

Benefits:
- Cleaner separation of concerns in CLI
- Testable business logic independent of file system
- Easier to extend with new commands
- Better error handling with domain exceptions
Complete technical specification for three interconnected features:

1. Multi-Step Authentication Flow:
   - Support for OAuth flows requiring multiple user decisions
   - State management across authentication steps
   - User choice persistence and validation
   - Error handling and rollback mechanisms

2. Shared Entity Management:
   - Cross-integration entity sharing and reuse
   - Entity ownership and access control
   - Entity lifecycle management (create, update, delete)
   - Relationship mapping between integrations and entities

3. Installation Wizard Integration:
   - Unified installation experience for complex integrations
   - Step-by-step guidance for configuration
   - Entity selection and creation workflow
   - Progress tracking and state persistence

Technical Details:
- Database schema for multi-step auth state
- API endpoints for authentication flows
- Frontend component specifications
- Security considerations and best practices
- Migration path from current single-step authentication
- Resolved merge conflicts in frigg CLI ui-command
- Updated package-lock.json dependencies
- Removed old non-DDD API handlers (integrations.js, project.js)
- Cleaned up error handler middleware
- Aligned frontend components with new DDD structure
- Updated hooks and pages to use new architecture

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Removed old CLI specification documents that were consolidated
- Deleted backup CLAUDE.md file
- Updated main CLI_SPECIFICATION.md with consolidated content
- Streamlined MULTI_STEP_AUTH_AND_SHARED_ENTITIES_SPEC.md

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Added repository interfaces and implementations for user management
- Implemented module repository with DDD patterns
- Created use cases for module entity operations (get, update, delete)
- Updated handlers and routers to use new repository pattern
- Enhanced integration router with better error handling
- Improved middleware for user context loading

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

Co-Authored-By: Claude <noreply@anthropic.com>
…hitecture

- Removed old non-DDD API handlers and services
- Deleted legacy integration and API module management code
- Cleaned up process manager and old server implementation
- Removed obsolete services (AWS monitor, npm registry, template engine)
- Updated server to use new DDD-based architecture
- Streamlined container with proper dependency injection
- Updated README with new architecture documentation
- Improved frigg CLI with better repo detection
- Enhanced serverless template generation

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Moved components to presentation layer following DDD architecture
- Removed duplicate and legacy UI components
- Deleted obsolete domain/application layer code from frontend
- Reorganized integration components into proper structure
- Cleaned up old codegen, monitoring, and connection components
- Removed unused UI library components (shadcn duplicates)
- Updated imports and dependencies throughout frontend
- Improved test utilities and component tests
- Enhanced UI package integration components

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Removed remaining obsolete CLI specification documents
- Added comprehensive TESTING_GUIDE for new architecture
- Updated MULTI_STEP_AUTH_AND_SHARED_ENTITIES_SPEC
- Added CLEANUP_SUMMARY documenting refactor changes
- Fixed middleware import paths
- Updated vite config for new structure
- Removed misplaced duplicate frigg-cli file

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

Co-Authored-By: Claude <noreply@anthropic.com>
…nnections directory

Handled by Frigg UI Library
…tegrations directory

Handled by Frigg UI LIbrary
Major refactor to create self-contained integration management:

- Add IntegrationHub: Drop-in component wrapping entire integration UX
- Add IntegrationTabs: Tab orchestration for gallery/accounts/builder
- Add UserActionTester: Dev mode component for testing user actions
- Update IntegrationBuilder: Support two flows (gallery install + entity build)
- Update EntityManager: Use context for friggBaseUrl/authToken
- Update IntegrationList: Extract baseUrl/authToken from context
- Update IntegrationDataContext: Centralize API calls and state
- Fix createIntegration signature to accept entities array (0-N)

Features added:
- View mode toggle (grid/list) in gallery
- Builder hidden from nav, triggered by Install button
- Context-based prop passing via FriggProvider
- Better empty states with "Connect Account" guidance
- Integration-specific entity selection messaging

Known issues to address:
- OAuth flow not yet implemented (shows alerts)
- Need to implement entity connection dropdowns
- Build integration entity selection needs refinement

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

Co-Authored-By: Claude <noreply@anthropic.com>
Implements dual authentication support in IntegrationBuilder:

- Add AuthModal component with smart auth type detection
- OAuth flow: Redirects to external authorization URL
- Form-based flow: Renders JSONForms with schema/uischema
- Refactor entity selection to row-based layout with dropdowns
- Add per-module Connect buttons when no accounts exist
- Add getAuthorizationRequirements API method

Entity Selection UX Improvements:
- Each required module gets dedicated row with dropdown
- Shows account name and external ID in dropdown options
- Connect buttons trigger AuthModal for OAuth or form auth
- Auto-refresh entity list after successful connection
- Green checkmark indicator for selected accounts

AuthModal Features:
- Detects auth type from authorization requirements response
- JSONForms integration for credential collection
- Handles form submission to /api/authorize endpoint
- Shows context-appropriate messaging for each flow
- Clean modal UI with proper error handling

Dependencies: Uses existing @jsonforms packages

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

Co-Authored-By: Claude <noreply@anthropic.com>
…l architecture

Adds support for multi-step authentication flows (e.g., email → OTP) while
maintaining 100% backward compatibility with existing single-step modules.
Implements clean DDD/hexagonal architecture with separation of concerns.

Backend (Core):
- AuthorizationSession domain entity with validation and state transitions
- Repository pattern with MongoDB and PostgreSQL implementations
- Three use cases: StartAuthorizationSession, ProcessAuthorizationStep, GetAuthorizationRequirements
- Updated integration router to handle multi-step flows automatically
- Prisma schema update with AuthorizationSession model
- 15-minute session expiry with auto-cleanup
- Comprehensive test suite: 275+ tests with 95% coverage

Frontend (UI):
- Unified AuthorizationWizard component treating all auth as multi-step
- Single-step flows are simply totalSteps: 1 (no conditional logic)
- Automatic progress bar, step counter, and button text adaptation
- Simplified EntityConnectionModal (60% code reduction)
- Updated API client with step and sessionId support
- Zero breaking changes to existing components

Security:
- Cryptographically secure session IDs (crypto.randomUUID)
- User ID validation on every operation
- Step sequence enforcement (prevents step skipping)
- Session expiry and auto-cleanup

Documentation:
- Complete migration guide with deployment steps
- UI library update guide with examples
- Nagaris OTP module implementation example
- Comprehensive test documentation

This enables modules like Nagaris to implement OTP flows without modifying
the UI layer, as the wizard automatically adapts based on getAuthStepCount().

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

Co-Authored-By: Claude <noreply@anthropic.com>
seanspeaks and others added 23 commits December 14, 2025 16:05
…nd CLI

- ADR-006: Integration Router v2 Restructuring
  - Documents modules removal, entity consolidation, proxy endpoints
  - Includes route structure, auth flow, and OpenAPI documentation

- ADR-007: Management UI Architecture
  - Documents proxy pattern for secure admin API access
  - Covers DDD layers, connection flow, user management modes

- ADR-008: Frigg CLI Start Command
  - Documents pre-flight checks and Docker integration
  - Covers error recovery strategies and environment handling

All ADRs include Mermaid diagrams for visual documentation.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…toring

Major Management UI enhancements:

**Frigg App Connection (Admin API Proxy)**
- Value objects: FriggAppConnection, UserManagementMode, AdminApiConfig
- Adapters: FriggAppHttpAdapter, FriggAdminApiAdapter
- Use cases: ConnectToFriggApp, ManageGlobalEntities, GetUserManagementMode
- Controller and routes for /api/frigg-app/*
- React hook useFriggAppConnection and AdminConnectionPanel component
- Secure proxy pattern - API key never sent to browser

**AI Agent Integration**
- ClaudeAgentAdapter for AI interactions
- Use cases: StartAgentSession, StopAgentSession, GetAgentSessionStatus
- Proposal entity with approve/reject/rollback use cases
- Chat session management with persistence

**CLI Start Command DDD Refactor**
- RunPreflightChecksUseCase for Docker/DB validation
- DockerAdapter, DatabaseAdapter infrastructure
- InteractivePromptAdapter for user interaction
- Unit tests for all new components

**Test Cleanup**
- Removed outdated integration tests
- Updated test setup and mocks
- Consolidated test helpers

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ecret simulation

Admin View Improvements:
- Auto-connect to local Frigg apps using server-side FRIGG_ADMIN_API_KEY
- Add SharedSecretSimulation component for arbitrary X-Frigg-AppOrgId/AppUserId testing
- Auto-switch to Users tab when connected

Test Zone Layout Fixes:
- Fix scrollable content area with flex-1 min-h-0 overflow-auto pattern
- Add resizable LiveLogPanel with useResizable hook
- Update collapse button to show "Collapse" text

Security Enhancements:
- Strict localhost URL validation for auto-connect endpoint
- Input sanitization for shared secret headers (length limits, character whitelist)
- Memory leak fix in useResizable cleanup

Accessibility:
- ARIA attributes for resize handle
- Keyboard support (Arrow Up/Down) for panel resizing

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…n key from repo .env

UserManagement.jsx was calling Frigg app directly (404 error). Now properly
routes through Management UI server proxy at /api/frigg-app/admin/users/*.

Auto-connect now reads FRIGG_ADMIN_API_KEY from the selected repository's
.env file (including backend/.env), falling back to server environment.
This allows users to start the UI from anywhere while still auto-connecting.

Changes:
- UserManagement: Use server proxy endpoints, add getDisplayName() helper
- AdminViewContainer: Accept and pass repositoryPath prop
- useFriggAppConnection: Accept repositoryPath, pass to auto-connect
- TestingZone: Pass currentRepository.path to AdminViewContainer
- FriggAppController: Use EnvFileReader to read from repository .env
- EnvFileReader: New adapter for reading .env files from any path

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Documents the rationale, structure, and future improvements for the
@friggframework/e2e package, including:
- Why we built it (testing gaps, no full lifecycle coverage)
- Architecture (test server, mock modules, fixtures)
- Test categories (lifecycle, management API, edge cases)
- Future improvements (PostgreSQL, encryption, WebSocket testing)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ailable

The auto-connect was running before currentRepository loaded from the
server, so repositoryPath was always undefined on first attempt. Now:
- Tracks the path used for auto-connect
- Retries once when repositoryPath becomes available after initial attempt
- Improved error message shows which .env paths were searched

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tart

Add automatic detection and resolution of pending PostgreSQL migrations
before starting a Frigg application:

- Add checkMigrationStatus() to detect pending Prisma migrations
- Add runMigrations() using prisma migrate deploy (non-interactive)
- Add _checkPostgresMigrations() check to RunPreflightChecksUseCase
- Add run_migrations resolution handler to interactive pre-flight flow
- Rewrite pre-flight loop to handle all resolution levels
- Add real-time logging during migration execution
- Detect pnpm workspace module resolution issues with helpful error

Only runs for PostgreSQL databases when DATABASE_URL is configured.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…l testing

Add server-side proxy for shared secret authentication and improved user
simulation in the Management UI Testing Zone:

Server-side changes:
- Add SharedSecretProxyUseCase for proxying requests with FRIGG_API_KEY
- Add AutoConnectUseCase to verify Frigg app connectivity
- Update EnvFileReader to read FRIGG_API_KEY from repo .env files
- Refactor FriggAppController to use new use cases
- Add comprehensive unit tests for new use cases

Client-side changes:
- Simplify SharedSecretSimulation component to use server proxy
- Refactor TestAreaUserSelection with cleaner state management
- Update TestingZone to coordinate user simulation workflow
- Simplify useFriggAppConnection hook

Template changes:
- Update .env.example with all Frigg configuration variables
- Add template-handler support for new environment variables

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…itions

The Options class was requiring display.label but integration definitions
use display.name. This caused a RequiredPropertyError when calling
GET /api/integrations.

Now accepts either 'name' (current convention) or 'label' (legacy fallback).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…on definitions"

This reverts commit ae55c7d. Keep label as the required field - integration
definitions should include both name and label.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Make detailsUrl and icon optional in display configuration
- Add _getModuleTypeName() helper for graceful fallback when getName() missing
- Fix DummyIntegration to use Options class properly
- Add 16 unit tests covering field validation and module type resolution

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix multiselect -> checkbox for @inquirer/prompts v5 compatibility
- Update docs URL from docs.frigg.dev to docs.friggframework.org
- Replace all create-frigg-app references with frigg init
- Rename create-frigg-app.md to frigg-init.md
- Update default app name fallback from create-frigg-app to frigg-app
- Add global entity tests and clean up code comments

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…k/schemas

- Updated AppDefinitionValidator to use validateAppDefinition from schemas package
- Updated IntegrationClassValidator to use validateIntegrationDefinition from schemas package
- Added proper JSON Pointer to dot notation path conversion for error messages
- Retained custom validation for class-level checks (lifecycle methods, Definition existence)
- Updated tests to align with schema validation behavior
- Removed tests for features the schema doesn't validate (runtime JS class references)

This consolidation ensures the frigg validate command uses the canonical
JSON Schema definitions rather than hand-rolled validation logic.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…mand

- Add ApiModuleValidator using validateApiModuleDefinition from @friggframework/schemas
- Update ValidateAppUseCase to validate API modules within integrations
- Wire up ApiModuleValidator in validate-command.js
- Add comprehensive test suite for API module validation

The validate command now validates all three definition types:
1. App Definition (app-definition.schema.json)
2. Integration Definition (integration-definition.schema.json)
3. API Module Definition (api-module-definition.schema.json)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ion schema

Add missing properties used by infrastructure code:
- managementMode: 'managed' | 'discover' | 'custom'
- vpcIsolation: 'isolated' | 'shared'
- label: Human-readable display name

Also add template-validation.test.js to verify frigg init templates
produce valid configurations against the schema.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…nition

Changed `static Config` to `static Definition` in the ExampleIntegration
template to match the pattern used in core integrations and expected by
the IntegrationClassValidator.

Updated template-validation.test.js to verify the correct pattern.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The validators now properly handle JavaScript classes and functions:

- AppDefinitionValidator: Replaces integration classes with stub objects
  before JSON Schema validation, since classes are functions in JS and
  fail the "type": "object" check

- ApiModuleValidator: Converts functions to {type: "function"} descriptors
  and class instances to {type: "object"} descriptors before validation,
  allowing JSON Schema to properly validate the structure while still
  rejecting unknown properties

This fixes the "must be object" errors when validating real Frigg apps
that pass integration classes like XeroIntegration in the integrations array.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The validator was checking for `definition.name` on API module definitions,
but the correct property is `moduleName` per:
- The API module JSON schema (requires moduleName)
- The core Module class (uses definition.moduleName)
- The getName() pattern (returns moduleName, not name)

This fix:
- Changes _validateModuleNames to check for moduleName instead of name
- Updates the error code from MISSING_NAME to MISSING_MODULE_NAME
- Updates tests to use moduleName in valid cases

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- New: docs/guides/INTEGRATION-PATTERNS.md with patterns for:
  - Process Model for sync tracking
  - friggCommands for integration config persistence
  - QueueManager for SQS job processing
  - Integration Events (USER_ACTION, CRON, QUEUE, WEBHOOK)
  - SyncOrchestrator for coordinating syncs
  - Webhook handling patterns

- Updated: docs/reference/api-module-definition-and-functions.md
  - Aligned with current JSON schema
  - Added complete OAuth2 and session-based auth examples
  - Documented env property naming (snake_case)
  - Added encryption configuration section

- Updated: CLAUDE.md
  - Added Integration Patterns section with quick reference
  - Links to new patterns guide

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When creating an OAuth global entity without CLIENT_ID/CLIENT_SECRET
configured in .env, the UI now prompts the user to enter credentials
via a form and writes them to the .env file.

Features:
- EnvFileAdapter: Infrastructure adapter for reading/writing .env files
- CheckOAuthCredentialsUseCase: Checks if OAuth credentials are configured
- WriteOAuthCredentialsUseCase: Writes credentials to .env with backup
- OAuthCredentialsPrompt: UI component for entering missing credentials
- API routes for checking and writing OAuth credentials
- 99 unit tests covering all components

Security:
- Path validation prevents traversal attacks
- Credential values sanitized (no newlines/control chars)
- Backup created before modifying .env files
- Actual credential values not exposed in API responses

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds createProcessRepository to the exports from @friggframework/core,
allowing integrations to use the Process model for tracking long-running
sync operations.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@seanspeaks seanspeaks added release Create a release when this pr is merged prerelease This change is available in a prerelease. labels Dec 20, 2025
@gitguardian
Copy link

gitguardian bot commented Dec 20, 2025

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
22520632 Triggered Generic High Entropy Secret defc8a3 packages/core/credential/repositories/tests/credential-repository-documentdb-encryption.test.js View secret
23374074 Triggered Generic Password 8c6a058 packages/devtools/frigg-cli/start-command/infrastructure/DatabaseAdapter.js View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@seanspeaks seanspeaks removed the prerelease This change is available in a prerelease. label Dec 20, 2025
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
102 Security Hotspots
4.8% Duplication on New Code (required ≤ 3%)
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

seanspeaks pushed a commit that referenced this pull request Dec 29, 2025
Research document evaluating unified vs separate deployments for:
- External customer-facing integrations
- Internal product integrations (Twilio/SendGrid)
- Company internal automations

Includes analysis of current architecture, proposed extensions for
scope/visibility classification, and recommendations.

Related to: #522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Create a release when this pr is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants