Class ShaftProjectService

java.lang.Object
com.shaft.mcp.ShaftProjectService

@Service public class ShaftProjectService extends Object
MCP project lifecycle tools backed by existing SHAFT generator assets and upgrader scripts.
  • Constructor Details

    • ShaftProjectService

      public ShaftProjectService()
      Creates the default project lifecycle MCP service.
  • Method Details

    • createProject

      @Tool(name="shaft_project_create", description="creates a new SHAFT Maven project from the same examples and rules used by the guide generator") public McpShaftProjectGenerationResult createProject(String outputDirectory, String runner, String platform, String groupId, String artifactId, String version, String shaftVersion, List<String> optionalModules, boolean includeGithubActions, boolean includeDependabot, boolean overwrite)
      Creates a SHAFT Maven project from the same examples and rules used by the guide generator.
      Parameters:
      outputDirectory - workspace-relative output directory
      runner - TestNG, JUnit, or Cucumber
      platform - web, mobile, or api where supported by the selected runner
      groupId - Maven group ID
      artifactId - Maven artifact ID; defaults to the guide generator artifact name when blank
      version - Maven project version; defaults to 1.0.0 when blank
      shaftVersion - optional override for generated project <shaft.version>
      optionalModules - optional SHAFT module artifact IDs
      includeGithubActions - whether to include the generated workflow for web/api projects
      includeDependabot - whether to include Dependabot configuration
      overwrite - whether existing files may be replaced
      Returns:
      generated project details
    • createProject

      public McpShaftProjectGenerationResult createProject(String outputDirectory, String runner, String platform, String groupId, String artifactId, String version, List<String> optionalModules, boolean includeGithubActions, boolean includeDependabot, boolean overwrite)
      Creates a SHAFT Maven project and resolves the generated <shaft.version> from Maven Central.
      Parameters:
      outputDirectory - workspace-relative output directory
      runner - TestNG, JUnit, or Cucumber
      platform - web, mobile, or api where supported by the selected runner
      groupId - Maven group ID
      artifactId - Maven artifact ID
      version - Maven project version
      optionalModules - optional SHAFT module artifact IDs
      includeGithubActions - whether to include a generated GitHub Actions workflow
      includeDependabot - whether to include Dependabot configuration
      overwrite - whether existing files may be replaced
      Returns:
      generated project details
    • upgradeProject

      @Tool(name="shaft_project_upgrade", description="runs the existing SHAFT modular project upgrader script against the current Java project") public McpShaftProjectUpgradeResult upgradeProject(String projectRoot, String upgradeType, boolean dryRun, boolean approve, String shaftVersion, String compileCommand, int compileTimeout, boolean skipBaselineCompile, boolean allowAiRepair)
      Runs the existing modular SHAFT project upgrader script against a Java project.
      Parameters:
      projectRoot - workspace-relative Java/Maven project root
      upgradeType - basic, session, or full
      dryRun - whether to preview changes without writing files
      approve - explicit approval required when dryRun is false
      shaftVersion - optional target SHAFT version
      compileCommand - optional compile command string passed to the upgrader
      compileTimeout - compile timeout in seconds; defaults to 900 when non-positive
      skipBaselineCompile - whether to pass --skip-baseline-compile
      allowAiRepair - whether to allow the upgrader to use its configured AI repair path
      Returns:
      upgrader process result
    • initAgents

      @Tool(name="shaft_project_init_agents", description="scaffolds SHAFT skill bridges and managed host-instruction blocks into an existing test repo for one or all coding-agent loops (all, claude, codex, opencode, vscode); preserves user-authored instruction text and only overwrites SHAFT-owned skill files when overwrite=true") public McpShaftProjectInitAgentsResult initAgents(String loop, String targetDirectory, boolean overwrite)
      Scaffolds SHAFT agent/skill bridge definitions into an existing test repo for a coding-agent loop.

      Every bridge is generated at call time from the bundled shaft-skills/&lt;skill&gt;/SKILL.md guides shipped inside the shaft-mcp jar, rather than a hand-duplicated copy of the full skill text, so the set of skills and their descriptions always tracks shaft-skills/ as of the shaft-mcp build. Existing skill files are left untouched unless overwrite is true; host instruction files always preserve user-authored bytes outside SHAFT's managed block. Existing recognized host adapters are refreshed alongside the selected loop, and all installs every supported host adapter.

      A bundled skill whose SKILL.md frontmatter declares distribution: full is a methodology skill whose value lives in its text, so it is scaffolded as its full body instead of a thin bridge: verbatim for claude/codex/opencode, and with an injected applyTo: "**" frontmatter key (body otherwise verbatim) for vscode. Skills without that key keep the thin bridge.

      Parameters:
      loop - all, claude, codex, opencode, or vscode
      targetDirectory - workspace-relative existing test repo directory
      overwrite - whether existing SHAFT-owned skill files may be replaced
      Returns:
      generated agent-scaffolding details