evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Build a tool that detects and repairs configuration drift in an Nx workspace by synchronizing workspace files using the Nx sync capability.
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.
Implement functionality to check whether the workspace is currently in sync. The tool should be able to:
Implement functionality to synchronize the workspace:
Support a dry-run mode that shows what would be synchronized without making actual changes:
/**
* 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>;Provides workspace synchronization capabilities, project graph access, and executor functionality.