Class FeatureName

java.lang.Object
network.ike.workspace.FeatureName

public final class FeatureName extends Object
Validated feature-name value — the <feature> portion of a branch name like feature/<feature> and the suffix portion of a sibling-clone directory name like <workspace>-<feature> (ike-issues#201, ike-issues#205).

Centralizes the regex enforcing "filesystem-safe" so the compiler can police a single typed entry point rather than scattered string templates at call sites (per the compiler-visibility principle).

Validation rules — syntactic only:

  • Non-empty
  • No path separators (/, \)
  • No whitespace
  • No shell-metacharacter hazards (*, ?, [, ], ", ', $, backtick)
  • ASCII letters, digits, -, _, .; must start with a letter or digit

Uniqueness checks (does a sibling directory already exist?) are intentionally not in this class — those depend on the caller's filesystem context and live in the calling Mojo.

  • Field Details

    • SIBLING_SEPARATOR

      public static final String SIBLING_SEPARATOR
      Separator between the primary workspace name and the feature in a sibling directory name: U+A789 MODIFIER LETTER COLON (), not a hyphen. A hyphen makes the suffix ambiguous against a hyphenated artifactId (ike-komet-wsr-installer-logs — is the base ike-komet-wsr or ike-komet-wsr-installer?); is an unambiguous boundary that never appears in an artifactId and renders as a colon-like glyph. It is filesystem-safe — it is not the reserved ASCII colon U+003A — and, having no NFC/NFD decomposition, it sidesteps the Syncthing cross-machine normalization hazard. Verified across APFS, git, Maven, and a live IntelliJ import (ike-issues#779).
      See Also:
  • Method Details

    • of

      public static FeatureName of(String raw)
      Validate raw and wrap it as a FeatureName.
      Parameters:
      raw - the candidate feature name (typically from a -Dfeature=<name> command-line argument)
      Returns:
      a validated FeatureName
      Throws:
      IllegalArgumentException - if raw is null, empty, or violates any documented rule
    • value

      public String value()
      The validated feature name as a string.
      Returns:
      the raw value (never null or empty)
    • siblingDirectoryName

      public String siblingDirectoryName(String primaryWorkspaceName)
      Compose the sibling-clone directory name for this feature inside the given primary workspace.

      For primaryWorkspaceName="ike-komet-wsr" and feature "reasoner", returns "ike-komet-wsr꞉reasoner" — the primary name and feature joined by SIBLING_SEPARATOR (꞉, U+A789), not a hyphen, so the feature suffix is unambiguous against a hyphenated artifactId.

      This is the single approved place to construct sibling directory names — call sites must not concatenate strings directly (ike-issues#205).

      Parameters:
      primaryWorkspaceName - the primary workspace's directory name; must be non-null and non-empty
      Returns:
      primaryWorkspaceName + SIBLING_SEPARATOR + value()
      Throws:
      IllegalArgumentException - if primaryWorkspaceName is null or empty
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object