CodeVetter · Repo Unpack · Behavior traces
nrwl/nx
The inspected paths cover startup, task execution, cache persistence/replay, and code generation in execution order. Branches matter: completion bypasses ordinary initialization, graph requests bypass task execution, and sync checks vary with CI and terminal availability. Cache hits restore or retain outputs before reporting task results. These are source-derived traces, not observed runtime sessions.
- Startup fast paths: main checks NX_COMPLETE and attempts value then command-surface completion; ordinary startup checks supported platforms and discovers the workspace, while --version skips root environment loading.
- Local startup: main resolves the local installation, initializes analytics, and calls initLocal; initLocal marks NX_CLI_SET, optionally queries the daemon for editor-extension status, then parses or rewrites arguments through commandsObject.
- Primary action: yargsRunCommand.handler calls runOne; runOne reads configuration and graph, parses options, selects tasks through selectTasksForProjects/createTaskGraph, calls runCommand, drains output, and exits with its status.
- Pre-execution: runTasksForCommand calls ensureWorkspaceIsInSyncAndGetGraphs, which validates targets/cycles, skips sync in CI or with skipSync, and otherwise obtains sync-generator changes; non-TTY out-of-sync execution exits before interactive application.
- Execution dispatch: invokeTasksRunner resolves the runner, loads Ultracache configuration before creating the hasher, performs upfront hashing, and calls tasksRunner; defaultTasksRunner constructs TaskOrchestrator, whose coordinator resolves cache hits, handles batches, then dispatches discrete workers.
- Persistence: postRunSteps records output hashes, persists terminal output, and calls cache.put; native put recreates the hash directory, writes terminal output, expands/copies declared artifacts, and upserts cache_outputs before completion releases further work.
- Replay: fetchCacheHits calls getBatch and checks whether each stored exit code is replayable; finalizeCacheHits checks output hashes, copies artifacts when necessary, derives local/remote/failure status, and prints stored output. runCommand returns failure for failed or skipped results and interruption status for incomplete runs.
- Generation: generate retrieves configurations, converts arguments, resolves generator information, and combines schema options; an Nx implementation receives FsTree, then the tree locks, changes print, and non-dry-run execution flushes changes before invoking the returned callback.