EU Parliament Monitor — API Documentation - v0.8.16
    Preparing search index...

    Function resolveUniqueAnalysisDir

    • Resolve a unique directory path by appending a numeric suffix (-2, -3, …) when the preferred directory has already been claimed by a completed run.

      The base directory is treated as occupied when it contains manifest.json (written at the end of a successful analysis run). A directory without manifest.json is considered available — this allows the skipCompleted feature to resume an incomplete run in the same directory.

      Suffixed candidates (-2, -3, …) are claimed atomically via non-recursive mkdirSync, preventing TOCTOU races when concurrent workflow runs attempt to claim the same candidate.

      Parameters

      • baseDir: string

        The preferred directory path (e.g. analysis/2026-04-02/breaking)

      Returns string

      The original baseDir when no completed run exists there, or a suffixed variant (e.g. analysis/2026-04-02/breaking-2) otherwise.