Class ScaffoldLockfileIo

java.lang.Object
network.ike.plugin.scaffold.ScaffoldLockfileIo

public final class ScaffoldLockfileIo extends Object
Read and write ScaffoldLockfile instances in the on-disk YAML format documented in the dev-ike-scaffold-architecture design note.

Uses SnakeYAML for parsing; emits a stable, human-friendly representation via block style with insertion-order preserved. The writer writes the schema version first, then the top-level stamps, then the files: map — so a hand-read diff of .ike/scaffold.lock stays easy to follow across publishes.

All emitted timestamps are in UTC ISO-8601 ("Z").

  • Method Details

    • read

      public static ScaffoldLockfile read(Path path)
      Parse a lockfile from a file path.
      Parameters:
      path - path to the YAML lockfile
      Returns:
      the parsed lockfile
      Throws:
      ScaffoldException - if the file cannot be read, is empty, or has an unsupported schema version
    • read

      public static ScaffoldLockfile read(Reader reader)
      Parse a lockfile from a Reader.
      Parameters:
      reader - source of YAML text
      Returns:
      the parsed lockfile
      Throws:
      ScaffoldException - if the YAML is empty or has an unsupported schema version
    • writeToString

      public static String writeToString(ScaffoldLockfile lockfile)
      Serialise a lockfile to YAML text. Does not touch disk.
      Parameters:
      lockfile - the lockfile to serialise
      Returns:
      its YAML representation
    • write

      public static void write(ScaffoldLockfile lockfile, Path path)
      Serialise a lockfile to a file path, creating parent directories if needed.
      Parameters:
      lockfile - the lockfile to serialise
      path - destination path
      Throws:
      ScaffoldException - if the file cannot be written
    • write

      public static void write(ScaffoldLockfile lockfile, Writer writer)
      Serialise a lockfile through any Writer.
      Parameters:
      lockfile - the lockfile to serialise
      writer - destination writer (not closed)