or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-6/

Workspace Configuration Synchronizer

Build a tool that detects and repairs configuration drift in an Nx workspace by synchronizing workspace files using the Nx sync capability.

Overview

Your task is to implement a workspace synchronization tool that checks if the workspace configuration is in sync and can repair any detected drift. The tool should leverage Nx's built-in sync capabilities to ensure all generated files and configurations are up to date with the current workspace state.

Requirements

Check Sync Status

Implement functionality to check whether the workspace is currently in sync. The tool should be able to:

  • Detect if any workspace files need to be synchronized
  • Report which files or configurations are out of sync
  • Return a status indicating whether the workspace is fully synchronized

Perform Synchronization

Implement functionality to synchronize the workspace:

  • Execute the sync operation to update all generated files
  • Handle any errors that occur during synchronization
  • Ensure all plugin-provided sync generators are executed

Dry Run Mode

Support a dry-run mode that shows what would be synchronized without making actual changes:

  • List all files that would be modified
  • Show the changes that would be applied
  • Do not modify any files in dry-run mode

Test Cases

  • Checking sync status on an out-of-sync workspace returns false @test
  • Checking sync status on a synchronized workspace returns true @test
  • Running sync on an out-of-sync workspace updates the files and returns success @test
  • Running sync in dry-run mode does not modify any files @test

Implementation

@generates

API

/**
 * Options for checking sync status
 */
interface CheckSyncOptions {
  /**
   * The workspace root directory
   */
  workspaceRoot: string;

  /**
   * Whether to output verbose information
   */
  verbose?: boolean;
}

/**
 * Options for performing synchronization
 */
interface SyncOptions {
  /**
   * The workspace root directory
   */
  workspaceRoot: string;

  /**
   * Whether to perform a dry-run (no actual changes)
   */
  dryRun?: boolean;

  /**
   * Whether to output verbose information
   */
  verbose?: boolean;
}

/**
 * Result of a sync status check
 */
interface SyncStatus {
  /**
   * Whether the workspace is in sync
   */
  inSync: boolean;

  /**
   * Files or configurations that are out of sync (if any)
   */
  outOfSyncFiles?: string[];
}

/**
 * Result of a synchronization operation
 */
interface SyncResult {
  /**
   * Whether the synchronization was successful
   */
  success: boolean;

  /**
   * Files that were modified (or would be modified in dry-run)
   */
  modifiedFiles: string[];

  /**
   * Any errors that occurred
   */
  errors?: string[];
}

/**
 * Checks whether the workspace is in sync
 *
 * @param options - Options for checking sync status
 * @returns Promise resolving to the sync status
 */
export function checkSyncStatus(options: CheckSyncOptions): Promise<SyncStatus>;

/**
 * Synchronizes the workspace files
 *
 * @param options - Options for performing synchronization
 * @returns Promise resolving to the sync result
 */
export function syncWorkspace(options: SyncOptions): Promise<SyncResult>;

Dependencies { .dependencies }

Nx { .dependency }

Provides workspace synchronization capabilities, project graph access, and executor functionality.

@satisfied-by