Skip to content

php-fast-forward/dev-tools

FastForward\DevTools

FastForward DevTools is a Composer plugin that standardizes quality checks, documentation builds, consumer repository bootstrap, and packaged agent skills across Fast Forward libraries.

PHP Version Composer Package Tests Coverage Metrics Docs License GitHub Sponsors

Fast Forward DevTools mascot

✨ Features

  • Aggregates refactoring, PHPDoc, code style, tests, and reporting under a single Composer-facing command vocabulary
  • Adds dependency analysis for missing and unused Composer packages through a single report entrypoint
  • Manages Keep a Changelog 1.1.0 files with local authoring, validation, version inference, release promotion, and release-note rendering commands
  • Ships shared workflow stubs, .editorconfig, Dependabot configuration, and other onboarding defaults for consumer repositories
  • Generates .github/CODEOWNERS files from local project metadata instead of shipping repository-specific owners into consumers
  • Synchronizes packaged agent skills into consumer .agents/skills directories using safe link-based updates
  • Works both as a Composer plugin and as a local binary
  • Preserves local overrides through consumer-first configuration resolution

🚀 Installation

composer require --dev fast-forward/dev-tools:dev-main

🛠️ Usage

Once installed, the plugin automatically exposes the aggregated dev-tools command and the individual Composer commands described below.

# Run all standard checks (refactoring, code styling, docs, tests, and reports)
composer dev-tools

# Automatically fix code standards issues where applicable
composer dev-tools:fix

You can also run individual commands for specific development tasks:

# Run PHPUnit tests
composer dev-tools tests

# Analyze missing, unused, and outdated Composer dependencies
composer dependencies
composer dependencies --max-outdated=8
composer dependencies --dev
composer dependencies --upgrade --dev

# Analyze code metrics with PhpMetrics
composer metrics
composer metrics --target=.dev-tools/metrics
composer --working-dir=packages/example metrics

# Add one changelog entry to Unreleased or a published version
composer changelog:entry "Add changelog automation for release workflows (#28)"
composer changelog:entry --type=fixed --release=1.2.0 --date=2026-04-19 "Preserve published release sections during backfill (#28)"

# Verify that the current branch added a meaningful Unreleased entry
composer changelog:check
composer changelog:check --against=origin/main

# Infer the next semantic version from Unreleased
composer changelog:next-version

# Promote Unreleased into a published version
composer changelog:promote 1.3.0

# Render one published section as release notes
composer changelog:show 1.3.0

# Check and fix code style using ECS and Composer Normalize
composer code-style

# Refactor code using Rector
composer refactor

# Check and fix PHPDoc comments
composer phpdoc

# Generate HTML API documentation using phpDocumentor
composer docs

# Generate Markdown documentation for the wiki
composer wiki

# Generate documentation frontpage and related reports
composer reports
composer reports --target=.dev-tools --coverage=.dev-tools/coverage

# Synchronize packaged agent skills into .agents/skills
composer skills

# Synchronize Composer funding metadata with .github/FUNDING.yml
composer funding
composer funding --dry-run

# Generate .github/CODEOWNERS from composer.json metadata
composer codeowners
composer codeowners --interactive

# Merges and synchronizes .gitignore files
composer gitignore

# Manages .gitattributes export-ignore rules for leaner package archives
composer gitattributes

# Generates a LICENSE file from composer.json license information
composer license

# Copies packaged or local resources into the consumer repository
composer copy-resource --source resources/docblock --target .docheader

# Installs Fast Forward Git hooks
composer git-hooks

# Updates the composer.json file to match the packaged schema
composer update-composer-json --force

# Installs and synchronizes dev-tools scripts, GitHub Actions workflows,
# .editorconfig, .gitignore rules, packaged skills, and the repository wiki
# submodule in .github/wiki
composer dev-tools:sync

The dependencies command ships with both dependency analyzers and rector/jack as direct dependencies of fast-forward/dev-tools, so it works without extra installation in the consumer project.

The metrics command ships with phpmetrics/phpmetrics as a direct dependency of fast-forward/dev-tools, so consumer repositories can generate metrics reports without extra setup.

The changelog commands manage Keep a Changelog 1.1.0 files without requiring extra tooling in the consumer repository. changelog:entry bootstraps a missing changelog file on first use, changelog:check enforces meaningful Unreleased entries in pull requests, changelog:next-version infers the next semantic version from pending changes, changelog:promote publishes the current Unreleased section into a tagged version, and changelog:show renders one published section for GitHub release notes.

When the packaged changelog workflow is synchronized into a consumer repository, pull requests are expected to add a notable changelog entry before merge. The same workflow can be triggered manually to prepare a release bump pull request from Unreleased, and merged release branches publish GitHub releases from the exact changelog section body.

The funding command keeps supported composer.json funding entries aligned with .github/FUNDING.yml, including GitHub Sponsors handles and custom URLs, while preserving unsupported providers in place and re-running composer normalize after manifest updates.

The codeowners command generates .github/CODEOWNERS from local composer.json metadata. It prefers explicit GitHub profile URLs from author metadata, falls back to commented suggestions from support metadata, and can prompt for owners when --interactive is used in a terminal.

The skills command keeps .agents/skills aligned with the packaged Fast Forward skill set. It creates missing links, repairs broken links, and preserves existing non-symlink directories. The dev-tools:sync command calls skills automatically after refreshing the rest of the consumer-facing automation assets.

The packaged workflow stubs synchronized by dev-tools:sync now also include changelog automation for pull-request validation and release preparation, so consumer repositories can adopt the same changelog-driven release flow without copying workflow logic by hand.

The release workflow is intentionally two-step: workflow_dispatch prepares a release/v... pull request, and merging that release pull request publishes the GitHub release and tag. Consumer repositories must enable GitHub Actions Read and write permissions and Allow GitHub Actions to create and approve pull requests under Settings -> Actions -> General. If those controls are disabled, an organization or repository admin must unlock them before the release-preparation workflow can create pull requests.

This repository also keeps role-based project agents in .agents/agents. They are mirrored through .github/agents for GitHub-oriented discovery, while the packaged .agents/skills directory remains the consumer-facing procedural source of truth.

🧰 Command Summary

Command Purpose
composer dev-tools Runs the full standards pipeline.
composer tests Runs PHPUnit with local-or-packaged configuration.
composer dependencies Previews Jack dependency updates, then reports missing, unused, and overly outdated Composer dependencies.
composer metrics Runs PhpMetrics for the current project and generates requested report artifacts.
composer changelog:entry Adds one categorized changelog entry to Unreleased or a published release section.
composer changelog:check Verifies that a changelog file contains meaningful Unreleased notes, optionally against a git base reference.
composer changelog:next-version Infers the next semantic version from the current changelog state.
composer changelog:promote Moves Unreleased entries into a published version section and records the release date.
composer changelog:show Renders one published changelog section for release notes and automation.
composer docs Builds the HTML documentation site from PSR-4 code and docs/.
composer skills Creates or repairs packaged skill links in .agents/skills.
composer funding Synchronizes managed funding metadata between composer.json and .github/FUNDING.yml.
composer codeowners Generates managed .github/CODEOWNERS content from local repository metadata.
composer gitattributes Manages export-ignore rules in .gitattributes.
composer dev-tools:sync Updates scripts, CODEOWNERS, funding metadata, workflow stubs, .editorconfig, .gitignore, .gitattributes, wiki setup, and packaged skills.

🔌 Integration

DevTools integrates with consumer repositories in two ways. The Composer plugin exposes the command set automatically after installation, and the local binary keeps the same command vocabulary when you prefer running tools directly from vendor/bin/dev-tools. The consumer sync flow also refreshes .agents/skills so agents can discover the packaged skills shipped with this repository.

🏗️ Architecture

  • Composer Plugin - FastForward\DevTools\Composer\Plugin exposes the packaged command set to Composer and runs dev-tools:sync after install and update.
  • DevTools Container - FastForward\DevTools\Console\DevTools::create() builds a shared container from DevToolsServiceProvider, which wires process execution, filesystem access, changelog services, Git helpers, diffing, reporting, and template loading.
  • Lazy Command Loading - DevToolsCommandLoader discovers #[AsCommand] classes and resolves most commands only when they are invoked, while orchestration commands such as standards dispatch other commands through the console application itself.
  • Consumer Sync Pipeline - dev-tools:sync refreshes composer.json, CODEOWNERS, funding metadata, workflow stubs, repository defaults, git metadata files, packaged Git hooks, and, in normal mode, the wiki submodule plus packaged skills.

🤝 Contributing

Run composer dev-tools before opening a pull request. If you change public commands or consumer onboarding behavior, update README.md and docs/ together so downstream libraries keep accurate guidance.

Notable pull requests are also expected to add a changelog entry before review is complete. A typical contributor flow looks like this:

# Record the user-visible change
composer changelog:entry --type=changed "Refine changelog automation for release publication (#28)"

# Validate that the branch added meaningful Unreleased notes
composer changelog:check --against=origin/main

For release preparation, maintainers can infer and promote the next version locally before using the packaged GitHub workflow:

# Inspect the version that Unreleased implies
composer changelog:next-version

# Publish Unreleased into the selected version and review the resulting notes
composer changelog:promote 1.3.0
composer changelog:show 1.3.0

📄 License

This package is licensed under the MIT License. See the LICENSE file for more details.

🔗 Links