# Persona Content Pack Implementation Tasks
**Goaly Goal ID**: 25
## Overview
This document provides a detailed breakdown of tasks required to implement the persona content pack system for hypertool-mcp. Tasks are organized by implementation phases with clear dependencies and acceptance criteria.
## Task Dependencies Graph
```
Phase 1: Foundation
TASK-001: Core Types & Interfaces
TASK-002: Custom Error Types
Phase 2: Configuration Support
TASK-003: YAML Schema Definitions (depends: TASK-001)
TASK-004: YAML Parser Implementation (depends: TASK-001, TASK-003)
TASK-005: Persona Validator (depends: TASK-001, TASK-002, TASK-004)
Phase 3: Discovery
TASK-006: File System Scanner (depends: TASK-001, TASK-002)
TASK-007: Persona Discovery Engine (depends: TASK-001, TASK-006)
Phase 4: Loading & Management
TASK-008: Persona Loader (depends: TASK-004, TASK-005, TASK-007)
TASK-009: Persona Cache System (depends: TASK-001, TASK-008)
TASK-010: Persona Manager (depends: TASK-008, TASK-009)
Phase 5: Integration
TASK-011: Toolset Bridge (depends: TASK-010)
TASK-012: MCP Config Integration (depends: TASK-010)
Phase 6: MCP Tools
TASK-013: List Personas Tool (depends: TASK-007)
TASK-014: Validate Persona Tool (depends: TASK-005)
TASK-015: Activate Persona Tool (depends: TASK-010, TASK-011)
TASK-016: Get Active Persona Tool (depends: TASK-010)
TASK-017: Deactivate Persona Tool (depends: TASK-010)
Phase 7: CLI Interface
TASK-018: Base Persona Command (depends: TASK-013, TASK-015)
TASK-019: CLI Subcommands (depends: TASK-018)
Phase 8: Testing
TASK-020: Unit Tests (depends: all implementation tasks)
TASK-021: Integration Tests (depends: TASK-020)
TASK-022: End-to-End Tests (depends: TASK-021)
```
---
## Phase 1: Foundation
### TASK-001: Core Types & Interfaces
**Goaly Task ID**: 190
**Priority**: P0 (Blocker)
**Estimated Effort**: 4 hours
**Dependencies**: None
**Assignee**: TBD
**Description**:
Create all TypeScript interfaces and types required for the persona system as defined in the design document.
**Deliverables**:
- `src/persona/types.ts` with all interfaces from design doc
- Export from `src/persona/index.ts`
**Acceptance Criteria**:
- [ ] PersonaConfig interface matches design spec
- [ ] PersonaToolset interface defined (name: string, toolIds: string[])
- [ ] LoadedPersona interface includes all required fields
- [ ] PersonaDiscoveryResult and PersonaReference types
- [ ] ValidationResult and PersonaValidationError types
- [ ] ActivationResult type defined
- [ ] PersonaAssets interface for file tracking
- [ ] All types properly exported with JSDoc comments
**Files to Create**:
- `src/persona/types.ts`
- `src/persona/index.ts`
**Files to Modify**:
- None
**Design Considerations**:
- PersonaToolset should be simpler than existing ToolsetConfig
- PersonaConfig name must be hyphen-delimited lowercase
- toolIds must follow namespacedName format (e.g., "git.status")
- ValidationResult should align with existing toolset ValidationResult
---
### TASK-002: Custom Error Types
**Goaly Task ID**: 191
**Priority**: P0 (Blocker)
**Estimated Effort**: 2 hours
**Dependencies**: None
**Assignee**: TBD
**Description**:
Define custom error classes and error codes for persona operations to provide clear, actionable error messages.
**Deliverables**:
- `src/persona/errors.ts` with custom error classes
- Error codes enum with all error scenarios
**Acceptance Criteria**:
- [ ] PersonaError extends Error with code, details, suggestions
- [ ] PersonaErrorCode enum covers all error scenarios
- [ ] Factory functions for common error types
- [ ] Error messages include actionable suggestions
- [ ] Proper error inheritance chain
- [ ] recoverable flag for error handling
**Files to Create**:
- `src/persona/errors.ts`
**Files to Modify**:
- `src/persona/index.ts` (export errors)
**Error Categories**:
- Discovery errors (permission, missing files)
- Validation errors (schema, business rules, tool resolution)
- Activation errors (persona not found, conflicts)
- Runtime errors (file system, memory)
---
## Phase 2: Configuration Support
### TASK-003: YAML Schema Definitions
**Goaly Task ID**: 192
**Priority**: P0 (Blocker)
**Estimated Effort**: 3 hours
**Dependencies**: TASK-001
**Assignee**: TBD
**Description**:
Create Zod schemas for validating persona YAML configuration structure with comprehensive validation rules.
**Deliverables**:
- Zod schemas for PersonaConfig validation
- Schema validation utilities and error formatting
**Acceptance Criteria**:
- [ ] PersonaConfigSchema validates all required fields
- [ ] PersonaToolsetSchema validates toolset structure
- [ ] Name format validation (^[a-z][a-z0-9-]*[a-z0-9]$)
- [ ] Array length validation (min 1 toolId per toolset)
- [ ] Optional fields handled correctly (defaultToolset, metadata)
- [ ] Clear validation error messages with field paths
- [ ] Support for both persona.yaml and persona.yml
**Files to Create**:
- `src/persona/schemas.ts`
**Files to Modify**:
- `src/persona/index.ts` (export schemas)
**Validation Rules**:
- name: required, hyphen-delimited lowercase
- description: required, min 10 characters
- toolsets: optional array, each with name and toolIds
- defaultToolset: optional, must exist in toolsets if provided
---
### TASK-004: YAML Parser Implementation
**Goaly Task ID**: 193
**Priority**: P0 (Blocker)
**Estimated Effort**: 4 hours
**Dependencies**: TASK-001, TASK-003
**Assignee**: TBD
**Description**:
Implement YAML parsing functionality for persona.yaml files with comprehensive error handling and type safety.
**Deliverables**:
- YAML parser with schema validation
- Error handling for malformed YAML
- Type-safe parsing results
**Acceptance Criteria**:
- [ ] Parse both persona.yaml and persona.yml files
- [ ] Handle YAML syntax errors gracefully
- [ ] Apply Zod schema validation after parsing
- [ ] Return structured ParseResult with detailed errors
- [ ] Preserve original YAML parsing errors with line numbers
- [ ] Support YAML features (comments, multi-line strings)
**Files to Create**:
- `src/persona/parser.ts`
**Files to Modify**:
- `src/persona/index.ts` (export parser functions)
**Integration**:
- Use existing yaml package (v2.8.0)
- Integrate with TASK-003 schemas
- Compatible with existing ValidationResult interface
---
### TASK-005: Persona Validator
**Goaly Task ID**: 194
**Priority**: P0 (Blocker)
**Estimated Effort**: 6 hours
**Dependencies**: TASK-001, TASK-002, TASK-004
**Assignee**: TBD
**Description**:
Implement multi-layer validation for persona configurations including schema, business rules, and tool resolution against the discovery engine.
**Deliverables**:
- PersonaValidator class with comprehensive validation
- Integration with discovery engine for tool validation
- Clear error categorization and suggestions
**Acceptance Criteria**:
- [ ] Schema structure validation using Zod schemas
- [ ] Business logic validation (folder name matches persona name)
- [ ] defaultToolset exists in toolsets array validation
- [ ] No duplicate toolset names validation
- [ ] Tool resolution validation via IToolDiscoveryEngine
- [ ] Detailed error messages with field-specific suggestions
- [ ] Warning vs error classification
- [ ] MCP config validation if mcp.json present
**Files to Create**:
- `src/persona/validator.ts`
**Files to Modify**:
- `src/persona/index.ts` (export validator)
**Validation Layers**:
1. YAML syntax and schema validation
2. Business rule validation
3. Tool availability validation
4. MCP config format validation
---
## Phase 3: Discovery
### TASK-006: File System Scanner
**Goaly Task ID**: 195
**Priority**: P0 (Blocker)
**Estimated Effort**: 4 hours
**Dependencies**: TASK-001, TASK-002
**Assignee**: TBD
**Description**:
Implement file system scanning functionality to find persona folders in standard and custom locations with proper error handling.
**Deliverables**:
- Directory scanner with configurable paths
- Async file system operations with proper error handling
- Permission and access error handling
**Acceptance Criteria**:
- [ ] Scan standard paths (~/.toolprint/hypertool-mcp/personas, ./personas)
- [ ] Support additional custom paths via configuration
- [ ] Recursive directory traversal with depth limits
- [ ] Handle permission errors gracefully without failing
- [ ] Filter for valid persona folder structure (contains persona.yaml/yml)
- [ ] Async/await pattern throughout with proper error handling
- [ ] Respect .gitignore patterns
**Files to Create**:
- `src/persona/scanner.ts`
**Files to Modify**:
- `src/persona/index.ts` (export scanner functions)
**Standard Paths**:
- `~/.toolprint/hypertool-mcp/personas/`
- `./personas/`
- Current working directory
---
### TASK-007: Persona Discovery Engine
**Goaly Task ID**: 196
**Priority**: P0 (Blocker)
**Estimated Effort**: 6 hours
**Dependencies**: TASK-001, TASK-006
**Assignee**: TBD
**Description**:
Implement the main discovery engine that orchestrates finding, quick-validating, and cataloging personas with caching support.
**Deliverables**:
- PersonaDiscovery class with comprehensive discovery logic
- Quick validation without full parsing for performance
- PersonaReference generation with metadata
**Acceptance Criteria**:
- [ ] Discover personas from all configured paths
- [ ] Quick validation without full YAML parsing (check file existence, basic structure)
- [ ] Generate PersonaReference objects with essential metadata
- [ ] Handle invalid personas gracefully without stopping discovery
- [ ] Collect discovery errors and warnings by path
- [ ] Return comprehensive PersonaDiscoveryResult
- [ ] Support refresh/rescan operations with change detection
**Files to Create**:
- `src/persona/discovery.ts`
**Files to Modify**:
- `src/persona/index.ts` (export discovery classes)
**Performance Considerations**:
- Quick validation to avoid parsing all YAML files
- Parallel scanning of multiple directories
- Caching of discovery results with TTL
---
## Phase 4: Loading & Management
### TASK-008: Persona Loader
**Goaly Task ID**: 197
**Priority**: P0 (Blocker)
**Estimated Effort**: 6 hours
**Dependencies**: TASK-004, TASK-005, TASK-007
**Assignee**: TBD
**Description**:
Implement persona loading functionality that parses YAML configs, loads MCP configurations, and catalogs all assets in persona folders.
**Deliverables**:
- PersonaLoader class with full loading capabilities
- MCP config loading and validation
- Asset cataloging for future extensibility
**Acceptance Criteria**:
- [ ] Load and parse persona.yaml/yml files using TASK-004 parser
- [ ] Load optional mcp.json files using existing MCPConfig types
- [ ] Validate loaded configurations using TASK-005 validator
- [ ] Create LoadedPersona objects with all metadata
- [ ] Catalog additional assets in persona folder for future use
- [ ] Handle loading errors gracefully with detailed error reporting
- [ ] Support both file extensions (.yaml and .yml)
**Files to Create**:
- `src/persona/loader.ts`
**Files to Modify**:
- `src/persona/index.ts` (export loader classes)
**Integration Points**:
- Use existing MCPConfig interface from src/types/config.ts
- Integrate with PersonaValidator from TASK-005
- Support future .htp archive format
---
### TASK-009: Persona Cache System
**Goaly Task ID**: 198
**Priority**: P1 (High)
**Estimated Effort**: 4 hours
**Dependencies**: TASK-001, TASK-008
**Assignee**: TBD
**Description**:
Implement caching system for loaded personas to improve performance and avoid repeated file system operations.
**Deliverables**:
- PersonaCache class with TTL-based caching
- Cache statistics and monitoring
- Memory management and cleanup
**Acceptance Criteria**:
- [ ] In-memory cache for LoadedPersona objects
- [ ] TTL-based expiration (configurable, default 5 minutes)
- [ ] Cache hit/miss statistics for monitoring
- [ ] Cache invalidation on file system changes
- [ ] Memory usage monitoring and limits
- [ ] Cache clear functionality for management
- [ ] Thread-safe cache operations
**Files to Create**:
- `src/persona/cache.ts`
**Files to Modify**:
- `src/persona/index.ts` (export cache classes)
**Performance Features**:
- LRU eviction for memory management
- File system watcher integration for auto-invalidation
- Configurable cache size limits
---
### TASK-010: Persona Manager
**Goaly Task ID**: 199
**Priority**: P0 (Blocker)
**Estimated Effort**: 8 hours
**Dependencies**: TASK-008, TASK-009
**Assignee**: TBD
**Description**:
Implement the main PersonaManager class that orchestrates persona lifecycle, activation/deactivation, and state management with event emission.
**Deliverables**:
- PersonaManager class extending EventEmitter
- Complete activation/deactivation workflow
- State management and persistence
**Acceptance Criteria**:
- [ ] Extend EventEmitter for state notifications
- [ ] Single active persona management (only one active at a time)
- [ ] Activate persona with optional toolset selection
- [ ] Deactivate current persona with cleanup
- [ ] Get active persona state and metadata
- [ ] List available personas with filtering options
- [ ] Emit events for all state changes
- [ ] Integration with discovery engine for tool validation
- [ ] Proper cleanup on deactivation (restore previous state)
**Files to Create**:
- `src/persona/manager.ts`
**Files to Modify**:
- `src/persona/index.ts` (export manager classes)
**Event Types**:
- persona:activated, persona:deactivated
- persona:discovered, persona:validation:failed
- persona:toolset:changed
---
## Phase 5: Integration
### TASK-011: Toolset Bridge
**Goaly Task ID**: 200
**Priority**: P0 (Blocker)
**Estimated Effort**: 6 hours
**Dependencies**: TASK-010
**Assignee**: TBD
**Description**:
Implement bridge between persona toolsets and existing ToolsetManager system to enable seamless integration.
**Deliverables**:
- Conversion from PersonaToolset to ToolsetConfig
- Integration with existing ToolsetManager
- Tool resolution and validation
**Acceptance Criteria**:
- [ ] Convert PersonaToolset to ToolsetConfig format
- [ ] Apply persona's defaultToolset on activation
- [ ] Validate tool availability via IToolDiscoveryEngine
- [ ] Handle tool resolution failures with clear error messages
- [ ] Maintain tool annotations/notes compatibility
- [ ] No breaking changes to existing toolset system
- [ ] Proper cleanup on persona deactivation
**Files to Create**:
- `src/persona/toolset-bridge.ts`
**Files to Modify**:
- `src/persona/manager.ts` (integrate bridge)
- `src/persona/index.ts` (export bridge)
**Integration Strategy**:
- Use existing DynamicToolReference format
- Leverage ToolsetManager.loadToolsetFromConfig
- Maintain compatibility with existing toolset tools
---
### TASK-012: MCP Config Integration
**Goaly Task ID**: 201
**Priority**: P1 (High)
**Estimated Effort**: 5 hours
**Dependencies**: TASK-010
**Assignee**: TBD
**Description**:
Implement integration with MCP configuration system to apply persona-specific server configurations.
**Deliverables**:
- MCP config merging logic with conflict resolution
- Configuration backup and restore
- Server connection management
**Acceptance Criteria**:
- [ ] Load persona mcp.json files using existing MCPConfig interface
- [ ] Merge with existing MCP configuration without conflicts
- [ ] Handle configuration conflicts with user choice or smart defaults
- [ ] Apply server configurations on persona activation
- [ ] Revert configurations on persona deactivation
- [ ] Validate MCP config format using existing validation
- [ ] Handle connection failures gracefully
**Files to Create**:
- `src/persona/mcp-integration.ts`
**Files to Modify**:
- `src/persona/manager.ts` (integrate MCP config)
- `src/persona/index.ts` (export integration)
**Conflict Resolution**:
- Persona configs take precedence over base config
- Backup original config for restoration
- Clear error messages for irreconcilable conflicts
---
## Phase 6: MCP Tools
### TASK-013: List Personas Tool
**Goaly Task ID**: 202
**Priority**: P1 (High)
**Estimated Effort**: 3 hours
**Dependencies**: TASK-007
**Assignee**: TBD
**Description**:
Implement MCP tool to list available personas with their validation status and metadata.
**Deliverables**:
- list-personas MCP tool following existing patterns
- Tool schema and input validation
**Acceptance Criteria**:
- [ ] MCP tool schema definition with optional includeInvalid parameter
- [ ] List all discovered personas with metadata
- [ ] Include validation status for each persona
- [ ] Support includeInvalid parameter to show invalid personas
- [ ] Return structured persona information (name, description, path)
- [ ] Handle discovery errors gracefully
- [ ] Follow existing tool patterns and response formats
**Files to Create**:
- `src/server/tools/persona/list-personas.ts`
**Files to Modify**:
- `src/server/tools/index.ts` (register tool if needed)
**Response Format**:
```json
{
"personas": [
{
"name": "dev-persona",
"description": "Development tools",
"path": "/path/to/persona",
"isValid": true,
"toolsetCount": 3
}
]
}
```
---
### TASK-014: Validate Persona Tool
**Goaly Task ID**: 203
**Priority**: P1 (High)
**Estimated Effort**: 3 hours
**Dependencies**: TASK-005
**Assignee**: TBD
**Description**:
Implement MCP tool to validate a specific persona's structure and configuration with detailed reporting.
**Deliverables**:
- validate-persona MCP tool with comprehensive validation
- Detailed validation reporting with suggestions
**Acceptance Criteria**:
- [ ] MCP tool schema with personaPath parameter (required)
- [ ] Comprehensive validation of persona structure
- [ ] Return detailed ValidationResult with errors, warnings, suggestions
- [ ] Include suggestions for fixing validation issues
- [ ] Handle file not found errors gracefully
- [ ] Support both folder paths and individual file paths
- [ ] Follow existing validation result formats
**Files to Create**:
- `src/server/tools/persona/validate-persona.ts`
**Files to Modify**:
- `src/server/tools/index.ts` (register tool if needed)
**Validation Coverage**:
- YAML syntax and schema validation
- Business rule validation
- Tool resolution validation
- MCP config validation
---
### TASK-015: Activate Persona Tool
**Goaly Task ID**: 204
**Priority**: P0 (Blocker)
**Estimated Effort**: 4 hours
**Dependencies**: TASK-010, TASK-011
**Assignee**: TBD
**Description**:
Implement MCP tool to activate a specific persona with optional toolset selection and comprehensive error handling.
**Deliverables**:
- activate-persona MCP tool with full activation logic
- Activation result reporting with detailed feedback
**Acceptance Criteria**:
- [ ] MCP tool schema with personaName (required) and toolsetName (optional)
- [ ] Activate specified persona using PersonaManager
- [ ] Apply default or specified toolset
- [ ] Return ActivationResult with success/error details
- [ ] Handle persona not found errors with suggestions
- [ ] Handle toolset not found errors
- [ ] Deactivate current persona if different one being activated
**Files to Create**:
- `src/server/tools/persona/activate-persona.ts`
**Files to Modify**:
- `src/server/tools/index.ts` (register tool if needed)
**Activation Flow**:
1. Validate persona exists and is valid
2. Deactivate current persona if any
3. Activate new persona
4. Apply toolset (default or specified)
5. Apply MCP config if present
---
### TASK-016: Get Active Persona Tool
**Goaly Task ID**: 205
**Priority**: P1 (High)
**Estimated Effort**: 2 hours
**Dependencies**: TASK-010
**Assignee**: TBD
**Description**:
Implement MCP tool to query the currently active persona state and metadata.
**Deliverables**:
- get-active-persona MCP tool with state reporting
- Current state metadata and status
**Acceptance Criteria**:
- [ ] MCP tool schema with no parameters (simple query)
- [ ] Return current active persona information if any
- [ ] Include active toolset information
- [ ] Return null/empty if no persona active
- [ ] Include activation timestamp and metadata
- [ ] Handle manager errors gracefully
- [ ] Follow existing response patterns
**Files to Create**:
- `src/server/tools/persona/get-active-persona.ts`
**Files to Modify**:
- `src/server/tools/index.ts` (register tool if needed)
**Response Fields**:
- persona name, description, source path
- active toolset name
- activation timestamp
- validation status
---
### TASK-017: Deactivate Persona Tool
**Goaly Task ID**: 206
**Priority**: P1 (High)
**Estimated Effort**: 2 hours
**Dependencies**: TASK-010
**Assignee**: TBD
**Description**:
Implement MCP tool to deactivate the currently active persona with proper cleanup.
**Deliverables**:
- deactivate-persona MCP tool with cleanup logic
- Deactivation confirmation and status
**Acceptance Criteria**:
- [ ] MCP tool schema with no parameters (simple action)
- [ ] Deactivate current persona using PersonaManager
- [ ] Revert toolset changes to previous state
- [ ] Revert MCP configuration changes
- [ ] Return success confirmation with deactivation details
- [ ] Handle no active persona gracefully
- [ ] Emit appropriate deactivation events
**Files to Create**:
- `src/server/tools/persona/deactivate-persona.ts`
**Files to Modify**:
- `src/server/tools/index.ts` (register tool if needed)
**Cleanup Operations**:
- Restore previous toolset if any
- Restore original MCP configuration
- Clear persona state
- Emit deactivation events
---
## Phase 7: CLI Interface
### TASK-018: Base Persona Command
**Goaly Task ID**: 207
**Priority**: P1 (High)
**Estimated Effort**: 4 hours
**Dependencies**: TASK-013, TASK-015
**Assignee**: TBD
**Description**:
Implement the base `hypertool persona` command structure and routing following existing command patterns.
**Deliverables**:
- Base command handler with subcommand routing
- Help text and documentation
- Error handling for command routing
**Acceptance Criteria**:
- [ ] Base `hypertool persona` command following existing patterns
- [ ] Subcommand routing to list, activate, validate, status, deactivate
- [ ] Help text for each command and subcommand
- [ ] Error handling for unknown subcommands
- [ ] Consistent output formatting with existing commands
- [ ] Progress indicators for long operations
- [ ] Integration with existing CLI framework
**Files to Create**:
- `src/commands/persona/index.ts`
**Files to Modify**:
- `src/bin.ts` (register persona command)
**Command Structure**:
```bash
hypertool persona --help
hypertool persona list [options]
hypertool persona activate <name> [options]
hypertool persona validate <path>
hypertool persona status
hypertool persona deactivate
```
---
### TASK-019: CLI Subcommands
**Goaly Task ID**: 208
**Priority**: P1 (High)
**Estimated Effort**: 6 hours
**Dependencies**: TASK-018
**Assignee**: TBD
**Description**:
Implement all persona CLI subcommands with proper argument parsing and user-friendly output.
**Deliverables**:
- Individual command implementations for each subcommand
- Argument parsing and validation
- Consistent output formatting and user feedback
**Acceptance Criteria**:
- [ ] `hypertool persona list [--include-invalid]` - list available personas
- [ ] `hypertool persona activate <name> [--toolset <toolset-name>]` - activate persona
- [ ] `hypertool persona validate <path>` - validate persona structure
- [ ] `hypertool persona status` - show current active persona
- [ ] `hypertool persona deactivate` - deactivate current persona
- [ ] Proper argument validation with helpful error messages
- [ ] Consistent output formatting with colors and tables
- [ ] Progress indicators and user feedback for operations
- [ ] Error messages with suggestions for resolution
**Files to Create**:
- `src/commands/persona/list.ts`
- `src/commands/persona/activate.ts`
- `src/commands/persona/validate.ts`
- `src/commands/persona/status.ts`
- `src/commands/persona/deactivate.ts`
**Files to Modify**:
- `src/commands/persona/index.ts` (register subcommands)
**Output Format Examples**:
- List: Table with name, description, status, toolsets
- Activate: Success message with applied toolset
- Validate: Error/warning list with suggestions
- Status: Current persona details and toolset
---
## Phase 8: Testing
### TASK-020: Unit Tests
**Goaly Task ID**: 209
**Priority**: P0 (Blocker)
**Estimated Effort**: 12 hours
**Dependencies**: All implementation tasks
**Assignee**: TBD
**Description**:
Create comprehensive unit tests for all persona system components with high coverage and edge case testing.
**Deliverables**:
- Unit tests for all classes and functions
- Mock implementations for external dependencies
- Test fixtures and sample data
**Acceptance Criteria**:
- [ ] >90% code coverage for persona module
- [ ] Test all public methods and functions
- [ ] Mock external dependencies (file system, discovery engine, toolset manager)
- [ ] Test error conditions and edge cases
- [ ] Test fixture personas for validation testing
- [ ] Async/await testing patterns
- [ ] Integration with existing test suite and CI
**Files to Create**:
- `src/persona/types.test.ts`
- `src/persona/parser.test.ts`
- `src/persona/validator.test.ts`
- `src/persona/scanner.test.ts`
- `src/persona/discovery.test.ts`
- `src/persona/loader.test.ts`
- `src/persona/cache.test.ts`
- `src/persona/manager.test.ts`
- `src/persona/toolset-bridge.test.ts`
- `test/fixtures/personas/` (test personas)
**Files to Modify**:
- `jest.config.js` (if needed for coverage)
**Test Categories**:
- Happy path testing
- Error condition testing
- Edge case testing
- Performance testing
- Mock integration testing
---
### TASK-021: Integration Tests
**Goaly Task ID**: 210
**Priority**: P1 (High)
**Estimated Effort**: 8 hours
**Dependencies**: TASK-020
**Assignee**: TBD
**Description**:
Create integration tests that verify persona system works with existing hypertool-mcp components.
**Deliverables**:
- Integration tests for persona + toolset interaction
- Integration tests for persona + MCP config interaction
- End-to-end persona activation scenarios
**Acceptance Criteria**:
- [ ] Test persona activation with real toolset system
- [ ] Test MCP config merging and application
- [ ] Test discovery engine integration
- [ ] Test event emission and handling
- [ ] Test CLI command integration
- [ ] Test MCP tool integration
- [ ] Use real file system operations (with cleanup)
**Files to Create**:
- `test/integration/persona-toolset.test.ts`
- `test/integration/persona-mcp-config.test.ts`
- `test/integration/persona-discovery.test.ts`
- `test/integration/persona-cli.test.ts`
**Files to Modify**:
- None
**Integration Scenarios**:
- Full persona activation workflow
- Toolset switching with personas
- MCP config merging scenarios
- Error recovery and cleanup
---
### TASK-022: End-to-End Tests
**Goaly Task ID**: 211
**Priority**: P2 (Medium)
**Estimated Effort**: 6 hours
**Dependencies**: TASK-021
**Assignee**: TBD
**Description**:
Create end-to-end tests that verify complete persona workflows from discovery to activation.
**Deliverables**:
- E2E test scenarios covering complete workflows
- Test environment setup and teardown
- Performance benchmarks and monitoring
**Acceptance Criteria**:
- [ ] Full persona discovery � validation � activation workflow
- [ ] Test with multiple personas and conflict scenarios
- [ ] Performance benchmarks for discovery and loading operations
- [ ] Memory usage validation and leak detection
- [ ] Concurrent operation testing
- [ ] Error recovery testing
- [ ] Long-running operation testing
**Files to Create**:
- `test/e2e/persona-workflows.test.ts`
- `test/e2e/persona-performance.test.ts`
**Files to Modify**:
- None
**E2E Scenarios**:
- Complete persona lifecycle
- Multi-persona environment
- Error recovery workflows
- Performance under load
---
## Success Criteria
The persona content pack implementation is considered complete when:
1. **All P0 tasks complete** - Core functionality works end-to-end
2. **Unit test coverage >90%** - Code quality and reliability assured
3. **Integration tests pass** - System integration verified
4. **CLI commands functional** - User interface complete and usable
5. **MCP tools operational** - Programmatic interface working
6. **No breaking changes** - Existing functionality preserved
7. **Performance benchmarks met** - System performs within acceptable limits
## Estimated Total Effort
- **P0 Tasks**: 55 hours (critical path)
- **P1 Tasks**: 33 hours (high value features)
- **P2 Tasks**: 6 hours (nice to have)
- **Total**: 94 hours
## Implementation Notes
### Dependencies and Integration
- Use existing `yaml` package (v2.8.0) for YAML parsing
- Leverage existing `ToolsetManager` and `IToolDiscoveryEngine` interfaces
- Build on existing `MCPConfig` and `ValidationResult` types
- Follow established patterns in `src/server/tools/` for MCP tools
- Use existing CLI command patterns from `src/commands/`
### Future Extensibility
- Design supports future .htp archive format
- Persona asset cataloging for future bundling
- Plugin architecture for custom validation rules
- Remote persona loading capabilities
### Quality Assurance
- Comprehensive error handling with user-friendly messages
- Progressive enhancement approach
- Graceful degradation when personas unavailable
- Clear documentation and examples
---
*Document Version: 1.0*
*Created: 2025-08-22*
*Last Updated: 2025-08-22*