Angular Modernizer
    Preparing search index...

    Orchestrates transformation feedback collection: start a session, record transformations, end the session with aggregated metrics.

    Each recorded transformation runs through: extract learnings, validate (with FeedbackValidator), anonymize and audit (with PrivacyFilter; a failed audit throws), add metadata, store (with FeedbackStorage). Stored records hold no code snippets, only metadata with hashed paths.

    Records go to the project root, the platform root or both (storageLocation, default 'both').

    Index

    Constructors

    Methods

    • End session and calculate aggregated outcome

      Loads all transformations from the session, calculates aggregated metrics (success/failure counts, quality, duration), extracts and aggregates learnings, and saves the final session with outcome to storage.

      Parameters

      • sessionId: string

        Session ID to end

      Returns Promise<SessionOutcome>

      Promise resolving to aggregated session outcome

      Error if session not found in any storage location

      Error if all storage writes fail when saving final session

      • Reads from project location first, falls back to platform
      • Aggregates learnings by pattern with success rates
      • Calculates quality based on >50% improved/degraded threshold
      • Writes final session to both storage locations
      const outcome = await collector.endSession(sessionId);
      console.info(`Success rate: ${outcome.successful}/${outcome.totalTransformations}`);
      console.info(`Quality: ${outcome.quality}`);
      console.info(`Learnings: ${outcome.aggregatedLearnings.length}`);
    • Extract learnings from transformation feedback

      Analyzes transformation feedback to identify patterns and extract actionable learnings. Detects 4 types of learnings: success patterns (high confidence successes), failure patterns, quality degradation (anti-patterns), and build failures.

      Parameters

      Returns Learning[]

      Array of learnings extracted from feedback

      Learning Types:

      • success-pattern: High confidence (>0.8) successful transformations
      • failure-pattern: Failed transformations or build failures
      • anti-pattern: Transformations that degraded code quality
      • optimization: (Future use)
      const learnings = collector.extractLearnings(feedback);
      learnings.forEach(learning => {
      console.info(`${learning.category}: ${learning.pattern}`);
      console.info(`Confidence: ${learning.confidence}`);
      console.info(`Recommendation: ${learning.description}`);
      });
    • Record transformation feedback for a session

      Extracts learnings, validates, anonymizes, and stores transformation feedback with privacy audit enforcement. Feedback is written to both storage locations (by default) and includes metadata about reliability and completeness.

      Pipeline Order (CRITICAL):

      1. Extract learnings from feedback (populate learnings array)
      2. Validate feedback quality (with learnings included for accurate scoring)
      3. Apply privacy filter
      4. Audit privacy
      5. Add metadata
      6. Store to disk

      Parameters

      • sessionId: string

        Session ID returned from startSession

      • feedback: TransformationFeedback

        Transformation feedback to record (learnings array may be empty, will be populated)

      Returns Promise<void>

      Error if privacy audit fails (contains code snippets, real paths, etc.)

      Error if validation errors occur (warnings don't block storage)

      Error if all storage writes fail

      • Learning extraction occurs BEFORE validation to ensure accurate completeness scores
      • Validation errors block storage, warnings don't
      • Partial storage failures are logged but don't throw
      • Privacy filter and audit are always enforced
      await collector.recordTransformation(sessionId, {
      transformationId: 'uuid',
      timestamp: new Date().toISOString(),
      rule: { ... },
      target: { ... },
      decision: { ... },
      execution: { ... },
      validation: { ... },
      outcome: { ... },
      learnings: [], // Will be populated automatically
      metadata: { ... }
      });
    • Start a new transformation session

      Initializes a feedback collection session with project context capture and dual-location file creation. The session tracks all transformations performed during the lifecycle until endSession is called.

      Parameters

      Returns Promise<string>

      Promise resolving to the unique session ID (UUID v4)

      Error if session initialization fails at all storage locations

      const sessionId = await collector.startSession({
      projectRoot: '/path/to/project',
      project: myTsMorphProject
      });