Class GitConfigAdapter

java.lang.Object
network.ike.plugin.scaffold.GitConfigAdapter
All Implemented Interfaces:
ModelAdapter

public final class GitConfigAdapter extends Object implements ModelAdapter
Model adapter for git config files (~/.gitconfig or a repository's .git/config).

Git config is an INI-flavoured format: sections like [core] and [alias "co"] (a subsection) contain key = value pairs. This adapter parses the format line-by-line, preserving comments and unknown sections verbatim, and ensures named keys are present under named sections.

Supported ensure subtree:

ensure:
  core:
    autocrlf: "false"
    excludesfile: "~/.gitignore_global"
  "alias":
    st: "status -sb"

Keys under each section are ensured independently. If a key is already present with any value, the user's value wins (we don't overwrite), but the key is still recorded as managed. Missing keys get appended to the end of the matching section, or a new section is created at end of file if the section itself is missing.

  • Field Details

  • Constructor Details

    • GitConfigAdapter

      public GitConfigAdapter()
      Construct a stateless git-config adapter. Instances are safe to share across planning calls; all per-invocation state lives on method parameters.
  • Method Details

    • modelName

      public String modelName()
      Description copied from interface: ModelAdapter
      Model name this adapter handles, matching ManifestEntry.model() (e.g. "maven-settings-4").
      Specified by:
      modelName in interface ModelAdapter
      Returns:
      the model name; never null
    • plan

      public ModelPlanResult plan(ManifestEntry entry, Path resolvedDest, byte[] currentContent, LockfileEntry priorEntry, String currentStandardsVersion)
      Description copied from interface: ModelAdapter
      Plan a single model-managed entry.
      Specified by:
      plan in interface ModelAdapter
      Parameters:
      entry - the manifest entry; must have ScaffoldTier.MODEL_MANAGED tier and model() equal to ModelAdapter.modelName()
      resolvedDest - absolute destination path (placeholders already expanded)
      currentContent - bytes currently on disk at resolvedDest, or null if no file exists
      priorEntry - lockfile entry from the last publish, or null if never applied
      currentStandardsVersion - the standards-version of the current manifest; stamped on newly-installed elements so drift can be reasoned about later
      Returns:
      a ModelPlanResult with both a TierAction and the element-level provenance for the lockfile