Record Class ScaffoldLockfile

java.lang.Object
java.lang.Record
network.ike.plugin.scaffold.ScaffoldLockfile
Record Components:
schema - lockfile schema version (currently CURRENT_SCHEMA); future schema bumps will be accompanied by an in-place migrator
standardsVersion - ike-build-standards version that produced the last applied state; may be null for a newly created lockfile that has not yet had a successful publish
applied - UTC timestamp of the last successful publish; may be null (never published)
files - per-file entries, keyed by scaffold path. Paths are normalised to forward slashes and may use the "~/" prefix for user-home scope. Insertion order is preserved. The stored map is unmodifiable.

public record ScaffoldLockfile(int schema, String standardsVersion, Instant applied, Map<String, LockfileEntry> files) extends Record
In-memory representation of a scaffold lockfile.

Two lockfile instances exist per scaffold run:

  • {project.root}/.ike/scaffold.lock — committed to git, tracks what the scaffold has installed in a project.
  • {user.home}/.ike/scaffold.lock — local to a machine, tracks what the scaffold has installed in the user-home tier (~/.git-hooks/, ~/.m2/settings.xml, etc.).

The on-disk format is YAML; see ScaffoldLockfileIo for parse/emit.

This class records only current scaffold-owned state; it never stores user secrets or free-form user content.

  • Field Details

    • CURRENT_SCHEMA

      public static final int CURRENT_SCHEMA
      The current on-disk schema version. Bumps here must be paired with a migration in ScaffoldLockfileIo.
      See Also:
  • Constructor Details

    • ScaffoldLockfile

      public ScaffoldLockfile(int schema, String standardsVersion, Instant applied, Map<String, LockfileEntry> files)
      Canonical constructor with validation and defensive copying of the file map.
  • Method Details

    • empty

      public static ScaffoldLockfile empty()
      Create an empty lockfile at the current schema with no entries and no applied state. Useful for initialising a new scaffold target.
      Returns:
      a blank ScaffoldLockfile at CURRENT_SCHEMA
    • withEntry

      public ScaffoldLockfile withEntry(String path, LockfileEntry entry)
      Return a copy of this lockfile with one entry added or replaced.
      Parameters:
      path - scaffold path key
      entry - entry to store
      Returns:
      a new lockfile with the entry in place (insertion order preserved: new keys append; existing keys keep their position)
    • withoutEntry

      public ScaffoldLockfile withoutEntry(String path)
      Return a copy of this lockfile with one entry removed.
      Parameters:
      path - scaffold path key to drop; missing keys are ignored
      Returns:
      a new lockfile without that entry; the same instance if the entry was already absent
    • withAppliedStamp

      public ScaffoldLockfile withAppliedStamp(String standardsVersion, Instant applied)
      Return a copy with the top-level standardsVersion and applied stamps updated (used when publish completes).
      Parameters:
      standardsVersion - the ike-build-standards version just applied; must not be null
      applied - timestamp of the publish; must not be null
      Returns:
      a new lockfile with updated stamps
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • schema

      public int schema()
      Returns the value of the schema record component.
      Returns:
      the value of the schema record component
    • standardsVersion

      public String standardsVersion()
      Returns the value of the standardsVersion record component.
      Returns:
      the value of the standardsVersion record component
    • applied

      public Instant applied()
      Returns the value of the applied record component.
      Returns:
      the value of the applied record component
    • files

      public Map<String, LockfileEntry> files()
      Returns the value of the files record component.
      Returns:
      the value of the files record component