Class SubprojectInitializer

java.lang.Object
network.ike.plugin.ws.bootstrap.SubprojectInitializer

public final class SubprojectInitializer extends Object
Walks the subprojects declared in workspace.yaml and ensures each one is cloned and initialized with the workspace-standard configuration: post-checkout git hook, Maven wrapper at the declared version, .mvn/jvm.config, and the per-subproject CLAUDE.md / CLAUDE-<name>.md pair.

Subsumes the per-subproject half of the retired InitWorkspaceMojo (folded into ws:scaffold-init per IKE-Network/ike-issues#393). Three initialization modes per subproject:

  1. Already cloned — directory has .git/; fetch + rebase if clean, otherwise skip with a warning.
  2. Syncthing working tree — directory exists but no .git/. Initializes git in-place: git init, adds the remote, fetches, and resets to match the remote branch. This preserves file content synced from another machine.
  3. Fresh clone — no directory; runs git clone.

Subprojects are initialized in topological (dependency) order.

See Also:
  • Constructor Details

    • SubprojectInitializer

      public SubprojectInitializer(network.ike.workspace.WorkspaceGraph graph, File root, String workspaceName, org.apache.maven.api.plugin.Log log)
      Bind an initializer to an already-loaded workspace.
      Parameters:
      graph - the loaded workspace graph
      root - the workspace root directory
      workspaceName - workspace artifactId, used in the report header
      log - the mojo logger
  • Method Details

    • run

      public SubprojectInitializer.Result run() throws org.apache.maven.api.plugin.MojoException
      Run the full per-subproject initialization pass and emit the workspace-level docs (GOALS.md, WS-REFERENCE.md, CLAUDE.md, CLAUDE-&lt;name&gt;.md).
      Returns:
      the per-subproject outcome counters
      Throws:
      org.apache.maven.api.plugin.MojoException - if any clone/fetch step fails
    • generateWorkspaceClaudeMd

      public static String generateWorkspaceClaudeMd(String wsName, network.ike.workspace.WorkspaceGraph graph)
      Generate CLAUDE.md for the workspace root. Static so the generator can be unit-tested without instantiating the mojo.
      Parameters:
      wsName - the workspace name
      graph - the loaded workspace graph (unused in the body but kept so future per-subproject summaries can be threaded through without an API break)
      Returns:
      the markdown content
    • generateComponentClaudeMd

      public static String generateComponentClaudeMd(network.ike.workspace.Subproject subproject)
      Generate CLAUDE.md for a subproject directory. Static for testability.
      Parameters:
      subproject - the subproject definition
      Returns:
      the markdown content
    • generateClaudeNotes

      public static String generateClaudeNotes(String name)
      Generate the starter template for hand-authored project notes. Static for testability.
      Parameters:
      name - the subproject or workspace name
      Returns:
      the markdown content
    • generateGoalCheatsheet

      public static String generateGoalCheatsheet()
      Generate the workspace goal cheatsheet (GOALS.md). Static so the content can be diffed independently of the mojo.
      Returns:
      the markdown content
    • generateWorkspaceReference

      public static String generateWorkspaceReference()
      Generate the long-form workspace goal reference (WS-REFERENCE.md). Static for testability.
      Returns:
      the markdown content