Angular Modernizer
    Preparing search index...

    Transform Rule Executor - Executes transform rules with integrated feedback collection

    This class wraps the execution of transformation rules and automatically captures feedback data for AI learning when a session is active. The feedback collection is:

    • Automatic (zero manual effort)
    • Comprehensive (pre/post state, validation, quality metrics)
    • Privacy-preserving (hashed paths, bucketed metrics)
    • Non-blocking (errors don't fail transformation)
    • Dual-storage (written to both project and platform by default)

    With a session ID, a run captures the pre-transformation state (complexity, LOC), executes the rule, captures the post-transformation state, records the feedback and returns the result with feedbackId and storageLocations. Without a session ID it only executes the rule.

    const executor = new TransformRuleExecutor(feedbackCollector);

    // Without feedback collection (backward compatible)
    const result = await executor.executeRule(rule, context);

    // With feedback collection
    const resultWithFeedback = await executor.executeRule(rule, context, sessionId);
    console.info(`Feedback: ${resultWithFeedback.feedbackId}`);
    console.info(`Stored in: ${resultWithFeedback.storageLocations?.join(', ')}`);
    Index

    Constructors

    Methods

    Constructors

    • Creates a new TransformRuleExecutor

      Parameters

      • feedbackCollector: FeedbackCollector

        Feedback collector instance configured with storage locations

      Returns TransformRuleExecutor

      const feedbackCollector = new FeedbackCollector({
      projectRoot: process.cwd(),
      platformRoot: path.join(__dirname, '../..'),
      storageLocation: 'both' // DEFAULT: write to both locations
      });

      const executor = new TransformRuleExecutor(feedbackCollector);

    Methods

    • Execute a transformation rule with optional feedback collection

      Executes the rule and automatically captures feedback if a sessionId is provided. The feedback collection includes:

      • Pre-transformation state (complexity, LOC, test coverage)
      • Transformation execution (success/failure, duration, errors)
      • Post-transformation state
      • Quality metrics (before/after deltas)
      • Extracted learnings (success patterns, failures, anti-patterns)

      Parameters

      • rule: TransformRule

        The transformation rule to execute

      • context: TransformContext

        The transformation context

      • OptionalsessionId: string

        Optional feedback session ID for automatic collection

      Returns Promise<TransformResultWithFeedback>

      Promise resolving to transform result with optional feedback metadata

      // Without feedback collection (backward compatible)
      const result = await executor.executeRule(rule, context);

      // With feedback collection
      const sessionId = await collector.startSession(transformContext);
      const result = await executor.executeRule(rule, context, sessionId);
      console.info(`Feedback ID: ${result.feedbackId}`);
      console.info(`Stored in: ${result.storageLocations?.join(', ')}`);