Record Class CaptureTeamPolicy

java.lang.Object
java.lang.Record
com.shaft.capture.runtime.CaptureTeamPolicy

public record CaptureTeamPolicy(Optional<Boolean> headless, String outputDirectory, String browser) extends Record
Team recorder policy checked into the repository at .shaft/recorder-policy.json (issue #3425 C4). When present, every recording started against that workspace — from the IntelliJ plugin, an agent CLI, or a raw MCP call — honors the same team defaults, so recordings land in a consistent place with consistent privacy/browser settings across the whole team.

Schema (all fields optional):

{
  "headless": false,           // lock recordings to headed/headless
  "outputDirectory": "recordings", // workspace-relative directory every recording lands in
  "browser": "Chrome"          // default browser when a request does not name one
}
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Workspace-relative location of the policy file.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CaptureTeamPolicy(Optional<Boolean> headless, String outputDirectory, String browser)
    Creates an immutable policy.
  • Method Summary

    Modifier and Type
    Method
    Description
    applyOutputDirectory(String requestedOutputPath, String defaultFileName)
    Re-roots a requested output path into the policy's output directory, preserving the requested file name.
    Returns the value of the browser record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the headless record component.
    load(Path workspaceRoot)
    Loads the policy for a workspace root; an absent or unreadable file yields the empty policy so recording never breaks because of a malformed policy — it just falls back to defaults.
    Returns the value of the outputDirectory record component.
    boolean
    Whether the policy file declared anything at all.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • CaptureTeamPolicy

      public CaptureTeamPolicy(Optional<Boolean> headless, String outputDirectory, String browser)
      Creates an immutable policy.
  • Method Details

    • load

      public static CaptureTeamPolicy load(Path workspaceRoot)
      Loads the policy for a workspace root; an absent or unreadable file yields the empty policy so recording never breaks because of a malformed policy — it just falls back to defaults.
      Parameters:
      workspaceRoot - workspace root directory
      Returns:
      the parsed policy, or an empty policy
    • present

      public boolean present()
      Whether the policy file declared anything at all.
      Returns:
      true when at least one field is set
    • applyOutputDirectory

      public String applyOutputDirectory(String requestedOutputPath, String defaultFileName)
      Re-roots a requested output path into the policy's output directory, preserving the requested file name. Blank requests get a caller-supplied default file name.
      Parameters:
      requestedOutputPath - the caller's output path, possibly blank
      defaultFileName - file name used when the request is blank
      Returns:
      workspace-relative output path honoring the policy directory, or the original request when the policy declares no directory
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • headless

      public Optional<Boolean> headless()
      Returns the value of the headless record component.
      Returns:
      the value of the headless record component
    • outputDirectory

      public String outputDirectory()
      Returns the value of the outputDirectory record component.
      Returns:
      the value of the outputDirectory record component
    • browser

      public String browser()
      Returns the value of the browser record component.
      Returns:
      the value of the browser record component