Skip to content

Extract Git hook logic into fast-forward/git-hooks package #296

@coisa

Description

@coisa

Objective

Extract the Git hook payloads and supporting hook-specific runtime logic from fast-forward/dev-tools into a dedicated fast-forward/git-hooks package.

Current Limitation

fast-forward/dev-tools currently owns the packaged hook templates, placeholder rendering, DevTools-specific config-path resolution, and installation workflow for Git hooks. That coupling makes the hook surface harder to evolve independently, prevents reuse outside DevTools, and keeps hook-specific packaging concerns mixed into a broader automation package.

Proposed Work

Create a focused fast-forward/git-hooks repository/package that owns the packaged hook payloads and the hook-specific runtime support currently embedded in DevTools. fast-forward/dev-tools should become a consumer and orchestrator of that package instead of the canonical home for hook internals.

The extraction may evaluate fast-forward/composer-installers when it helps standardize installation paths or package layout, but the initiative should not depend on adopting it unless it clearly simplifies the integration.

Scope

  • Define the package boundary between fast-forward/dev-tools and fast-forward/git-hooks.
  • Move packaged Git hook templates and their dedicated rendering/path-resolution support into the extracted package.
  • Update DevTools to consume the extracted package during git-hooks and dev-tools:sync flows.
  • Preserve the current GrumPHP behavior where hooks prefer a project-local grumphp.yml and otherwise use the managed packaged fallback.

Non-goals

  • Extract unrelated sync assets such as workflows, CODEOWNERS, licenses, docs scaffolding, or other consumer automation payloads in the same initiative.
  • Redesign the supported Git hook behavior beyond what is required to complete the extraction safely.
  • Require fast-forward/composer-installers adoption if the extraction can stay simpler without it.

Acceptance Criteria

Delivery Criteria

  • A dedicated fast-forward/git-hooks package boundary is defined with explicit integration points for DevTools.
  • Packaged hook payloads and hook-specific rendering/path-resolution logic are moved out of fast-forward/dev-tools into the extracted package.
  • fast-forward/dev-tools consumes the extracted package for git-hooks and dev-tools:sync orchestration instead of owning the hook internals directly.
  • Local and global DevTools installations continue producing working hooks, including project-local grumphp.yml preference and packaged fallback behavior.
  • Focused tests are added or updated around the extracted boundaries and compatibility behavior.
  • Documentation and release notes are updated where the package split changes maintainer or consumer expectations.

Architectural / Isolation Criteria

  • MUST: The core logic MUST be isolated into dedicated classes or services instead of living inside command or controller entrypoints.
  • MUST: Responsibilities MUST be separated across input resolution, domain logic, processing or transformation, and output rendering when the change is non-trivial.
  • MUST: The command or controller layer MUST act only as an orchestrator.
  • MUST: The implementation MUST avoid tight coupling between core behavior and CLI or framework-specific I/O.
  • MUST: The design MUST allow future extraction or reuse with minimal changes.
  • MUST: The solution MUST remain extensible without requiring major refactoring for adjacent use cases.
  • MUST: Argument and option resolution MUST be validated separately from command execution logic.
  • MUST: Console formatting and rendering MUST stay separate from domain processing.
  • MUST: Exit behavior, error messaging, and generated output MUST remain deterministic and testable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions