mcp-ai-agent-guidelines
Version:
A comprehensive Model Context Protocol server providing advanced tools, resources, and prompts for implementing AI agent best practices
187 lines • 5.21 kB
TypeScript
/**
* Phase Workflow - Pure domain logic for design phase transitions
*
* This module provides pure functions for managing phase transitions
* and validation. All functions are deterministic and side-effect free.
*/
import type { PhaseId } from "./types.js";
/**
* Validates if a phase transition is allowed
*
* @param current - Current phase
* @param target - Target phase to transition to
* @returns true if transition is valid
*
* @example
* ```typescript
* const canMove = canTransition('discovery', 'requirements'); // true
* const cantSkip = canTransition('discovery', 'architecture'); // false
* ```
*/
export declare function canTransition(current: PhaseId, target: PhaseId): boolean;
/**
* Gets the next phase in the workflow
*
* @param current - Current phase
* @returns Next phase ID or null if at the end
*
* @example
* ```typescript
* const next = getNextPhase('discovery'); // 'requirements'
* const end = getNextPhase('implementation'); // null
* ```
*/
export declare function getNextPhase(current: PhaseId): PhaseId | null;
/**
* Gets the previous phase in the workflow
*
* @param current - Current phase
* @returns Previous phase ID or null if at the start
*
* @example
* ```typescript
* const prev = getPreviousPhase('requirements'); // 'discovery'
* const start = getPreviousPhase('discovery'); // null
* ```
*/
export declare function getPreviousPhase(current: PhaseId): PhaseId | null;
/**
* Validates phase completion based on content
*
* @param phase - Phase to validate
* @param content - Phase output content
* @returns Validation result with missing requirements
*
* @example
* ```typescript
* const result = validatePhaseCompletion('discovery', {
* problem_statement: 'Auth system needed',
* stakeholders: ['users', 'admins']
* });
* console.log(result.valid); // false (missing 'context')
* console.log(result.missing); // ['context']
* ```
*/
export declare function validatePhaseCompletion(phase: PhaseId, content: Record<string, unknown>): {
valid: boolean;
missing: string[];
};
/**
* Gets required outputs for a specific phase
*
* @param phase - Phase identifier
* @returns Array of required output keys
*
* @example
* ```typescript
* const reqs = getPhaseRequirements('discovery');
* // ['problem_statement', 'stakeholders', 'context']
* ```
*/
export declare function getPhaseRequirements(phase: PhaseId): string[];
/**
* Gets the full phase order sequence
*
* @returns Array of phase IDs in order
*
* @example
* ```typescript
* const phases = getPhaseOrder();
* // ['discovery', 'requirements', 'planning', ...]
* ```
*/
export declare function getPhaseOrder(): PhaseId[];
/**
* Gets the index of a phase in the workflow
*
* @param phase - Phase identifier
* @returns Zero-based index or -1 if not found
*
* @example
* ```typescript
* const index = getPhaseIndex('requirements'); // 1
* ```
*/
export declare function getPhaseIndex(phase: PhaseId): number;
/**
* Checks if a phase is the first in the workflow
*
* @param phase - Phase identifier
* @returns true if phase is first
*
* @example
* ```typescript
* const isFirst = isFirstPhase('discovery'); // true
* ```
*/
export declare function isFirstPhase(phase: PhaseId): boolean;
/**
* Checks if a phase is the last in the workflow
*
* @param phase - Phase identifier
* @returns true if phase is last
*
* @example
* ```typescript
* const isLast = isLastPhase('implementation'); // true
* ```
*/
export declare function isLastPhase(phase: PhaseId): boolean;
/**
* Calculates the percentage of phases completed
*
* @param current - Current phase
* @returns Percentage (0-100) of workflow completion
*
* @example
* ```typescript
* const progress = getPhaseProgress('requirements'); // ~16.67
* ```
*/
export declare function getPhaseProgress(current: PhaseId): number;
/**
* Gets all phases that come before the specified phase
*
* @param phase - Phase identifier
* @returns Array of preceding phase IDs
*
* @example
* ```typescript
* const deps = getPhaseDependencies('architecture');
* // ['discovery', 'requirements', 'planning', 'specification']
* ```
*/
export declare function getPhaseDependencies(phase: PhaseId): PhaseId[];
/**
* Validates a custom phase sequence
*
* @param sequence - Custom phase sequence to validate
* @returns Validation result with errors if invalid
*
* @example
* ```typescript
* const result = validatePhaseSequence(['discovery', 'implementation']);
* // { valid: false, errors: ['Missing required phases: ...'] }
* ```
*/
export declare function validatePhaseSequence(sequence: string[]): {
valid: boolean;
errors: string[];
};
/**
* Checks if all required phases are present in a sequence
*
* @param sequence - Phase sequence to check
* @param required - Array of required phase IDs
* @returns true if all required phases are present
*
* @example
* ```typescript
* const hasRequired = hasRequiredPhases(
* ['discovery', 'requirements'],
* ['discovery']
* ); // true
* ```
*/
export declare function hasRequiredPhases(sequence: PhaseId[], required: PhaseId[]): boolean;
//# sourceMappingURL=phase-workflow.d.ts.map