Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changelog/optional-skills-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: added
type: minor
---

Add opt-in `setup:skills` (`skills:setup`) to install LLM Skills as a consumer development dependency and configure sources through its official CLI. Preserve existing skills policies, register non-empty local skill payloads for DevTools itself, pin external DevTools skills to the executing source commit or an explicit ref, and add the Changelog source at `^0.4.0`. Support read-only previews and optional deferred synchronization.
12 changes: 12 additions & 0 deletions .changelog/tooling-capability-profiles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
category: added
type: minor
---

Adds versioned project capability profiles, interactive setup and tooling status
without installing additional tools. Standards and reports honor explicit
tests, quality, docs and metrics selections, reject invalid profiles and fail
when no checks are selected or a required selected tool is unavailable. Projects
without dev-tools.json retain the full legacy pipeline. This establishes the
selection contract for future optional runtimes; the bundled distribution is
unchanged.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ across Fast Forward libraries.
wiki generation gracefully when no runnable PHP surface exists
- Works both as a Composer plugin and as a local binary
- Preserves local overrides through consumer-first configuration resolution
- Supports selecting available checks per project through a versioned
[tooling capability profile](docs/commands/capability-profiles.rst)
- Provides optional [guided skills setup](docs/commands/setup-skills.rst)
through LLM Skills.

## 🚀 Installation

Expand Down
4 changes: 4 additions & 0 deletions dev-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": 1,
"capabilities": ["tests", "quality", "docs", "metrics", "dependencies"]
}
106 changes: 106 additions & 0 deletions docs/commands/capability-profiles.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
Project Capability Profiles
===========================

Use a project profile to choose which capabilities the ``standards`` and
``reports`` aggregators execute. Selection does not change the package's
bundled Composer requirements, install tools or download a smaller runtime.
Individual commands remain explicitly invokable regardless of the selection.

Configuration
-------------

The profile is ``dev-tools.json`` in the selected working project directory:

.. code-block:: json

{
"version": 1,
"capabilities": ["tests", "quality"]
}

Only ``version`` and ``capabilities`` are accepted. Version must be the integer
``1``. Capabilities must be a list of distinct supported strings; unknown keys,
names, duplicate names, invalid JSON and other versions fail validation.
A malformed existing file is preserved when configuration fails.

When the file is absent, aggregators retain their legacy full execution plan.
An explicit empty list is different: no checks are selected, so aggregators
fail rather than report a successful empty run. Removing the profile restores
the legacy plan; selecting every capability creates an explicit plan that also
applies project applicability and availability checks.

.. list-table::
:header-rows: 1

* - Capability
- Aggregate behavior
* - ``tests``
- ``reports`` runs tests with coverage when the project exposes testable
PHP source; ``standards`` delegates to that reporting plan.
* - ``quality``
- ``standards`` runs ``refactor``, ``phpdoc`` and ``code-style``.
* - ``docs``
- ``reports`` generates documentation when guides or API directories exist.
* - ``metrics``
- ``reports`` runs the metrics stage.
* - ``dependencies``
- Records dependency-analysis selection and tool availability. Run
``dependencies`` explicitly; it is not added to either aggregate plan.

Configure with setup
--------------------

``setup`` (alias ``tooling:configure``) offers an interactive multiple-choice
selection. Its default is the existing profile, or all capabilities when no
profile exists. Explicit options work without a prompt:

.. code-block:: bash

cpx --skip-local "fast-forward/dev-tools:$DEV_TOOLS_VERSION" setup
cpx --skip-local "fast-forward/dev-tools:$DEV_TOOLS_VERSION" setup --capability=tests --capability=quality --dry-run --no-interaction
cpx --skip-local "fast-forward/dev-tools:$DEV_TOOLS_VERSION" setup --capability=tests --capability=quality --no-interaction

Use an exact published CLI version exposing these commands; see
:doc:`../getting-started/installation`. When developing DevTools itself, replace
the CPX invocation with ``php bin/dev-tools``.

``--capability`` is repeatable and replaces the complete selection rather than
adding entries to the previous profile. Non-interactive setup requires at
least one explicit capability. ``--dry-run`` prints the proposed profile without
writing it. Repeating the same selection does not rewrite the file; capabilities
are stored in canonical order. Setup writes only the profile and installs no
dependencies or repository assets. Commit the reviewed profile with the project.

Inspect selection and availability
---------------------------------

.. code-block:: bash

cpx --skip-local "fast-forward/dev-tools:$DEV_TOOLS_VERSION" tooling:status
cpx --skip-local "fast-forward/dev-tools:$DEV_TOOLS_VERSION" tooling:status --json
cpx --skip-local "fast-forward/dev-tools:$DEV_TOOLS_VERSION" tooling:status --pretty-json

Status reports every capability's ``selected`` and ``available`` flags, missing
binary names and resolved binary paths. Structured output contains ``version``,
``profile`` and ``capabilities``; ``profile`` is ``null`` in legacy mode.
Availability checks existing executable files. It does not prove compatible
versions, project readiness or a successful quality run, and does not install
missing tools. A successful status command means inspection succeeded; inspect
the individual availability flags before running an aggregate.

Aggregate failures
------------------

With an explicit profile, aggregates fail when no selected checks apply or
required binaries for their execution plan are missing. For example:

* ``["quality"]`` runs the three quality phases in ``standards`` but gives
``reports`` no applicable stage.
* ``["docs"]`` fails ``reports`` when the project has neither guides nor API
directories.
* ``["dependencies"]`` gives neither aggregate an applicable stage; invoke
dependency analysis directly.

Output-directory options such as ``reports --metrics=...`` choose paths for an
enabled stage; they do not enable a capability omitted from the profile.
See :doc:`standards` and :doc:`reports` for execution order and output options.
2 changes: 2 additions & 0 deletions docs/commands/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Detailed documentation for each dev-tools command.
:maxdepth: 1

standards
capability-profiles
tests
changelog
dependencies
Expand All @@ -19,6 +20,7 @@ Detailed documentation for each dev-tools command.
reports
agents
skills
setup-skills
sync
self-update
funding
Expand Down
36 changes: 22 additions & 14 deletions docs/commands/reports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@ Generates the frontpage for Fast Forward documentation.
Description
-----------

The ``reports`` command generates the documentation frontpage, runs tests with
coverage, and generates code metrics. It combines:
Without ``dev-tools.json``, ``reports`` retains the legacy reporting plan:

- ``docs --target`` - generates API documentation
- ``tests --coverage`` - generates test coverage reports
- ``metrics --target`` - generates PhpMetrics HTML and JSON reports

The documentation build runs in parallel with PHPUnit, and the metrics step
runs after PHPUnit so it can reuse the generated JUnit report.
With an explicit :doc:`capability-profiles` selection, only selected applicable
``docs``, ``tests`` and ``metrics`` stages run. Documentation requires guides or
API directories; tests require testable PHP source. Metrics remains applicable
to repository metadata/history. ``quality`` and ``dependencies`` do not add
report stages. The command fails if the profile is invalid, no selected stage
applies or a required tool is unavailable.

When both are enabled, documentation runs in parallel with PHPUnit. Metrics
runs after PHPUnit when coverage is enabled so it can reuse its JUnit report.

Usage
-----
Expand All @@ -29,17 +35,18 @@ Options
-------

``--target`` (optional)
The target directory for the generated documentation.
The target directory for generated documentation when that stage is enabled.
Default: selected workspace directory, ``.dev-tools`` unless
``--workspace-dir`` or ``FAST_FORWARD_WORKSPACE_DIR`` is configured.

``--coverage, -c`` (optional)
The target directory for the generated test coverage report.
The target directory for test coverage when the tests stage is enabled.
Default: selected workspace ``coverage`` directory, usually
``.dev-tools/coverage``.

``--metrics`` (optional)
The target directory for the generated metrics report.
The target directory for metrics when that stage is enabled. Passing this
option does not enable ``metrics`` in the project profile.
Default: selected workspace ``metrics`` directory, usually
``.dev-tools/metrics``.

Expand Down Expand Up @@ -99,15 +106,16 @@ Exit Codes
* - Code
- Meaning
* - 0
- Success. Documentation, coverage, and metrics generated successfully.
- Success. The planned report stages completed successfully.
* - 1
- Failure. One or more report stages failed.
- Failure. A stage failed, required tools are unavailable, the profile is
invalid or no selected stages apply.

Behavior
---------

- Runs ``docs`` in parallel with ``tests --coverage``.
- Runs ``metrics --target`` after tests so the JUnit report is available.
- Runs enabled ``docs`` in parallel with enabled ``tests --coverage``.
- Runs enabled ``metrics --target`` after tests when both are selected.
- Cache stays enabled by default for nested cache-aware steps; omit both flags
to keep the command default, pass ``--cache`` to force it on, and pass
``--no-cache`` to force it off.
Expand All @@ -123,9 +131,9 @@ Behavior
- When ``--json`` or ``--pretty-json`` is active, it forwards JSON mode to the
``docs``, ``tests``, and ``metrics`` subprocesses and suppresses transient
progress output where those tools support it.
- Nested ``docs`` and ``tests`` stages can now skip gracefully with warnings in
guide-only or automation-only repositories, while ``reports`` still returns a
successful aggregate result for the stages that were actually generated.
- Without a profile, nested ``docs`` and ``tests`` stages retain their legacy
graceful-skip behavior. With a profile, report selection is filtered by
applicability first and an empty plan fails.
- Passes ``--junit <coverage>/junit.xml`` to the metrics step.
- Used by the ``standards`` command as the final phase.
- This is the reporting stage used by GitHub Pages.
Expand Down
120 changes: 120 additions & 0 deletions docs/commands/setup-skills.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
setup:skills
============

Opts a project into LLM Skills through its official Composer commands. The
alias is ``skills:setup``. This setup is independent of ordinary quality runs
and ``dev-tools:sync``; LLM Skills remains an optional consumer integration.

Usage
-----

.. code-block:: bash

cpx --skip-local "fast-forward/dev-tools:$DEV_TOOLS_VERSION" setup:skills --dry-run
cpx --skip-local "fast-forward/dev-tools:$DEV_TOOLS_VERSION" setup:skills

Select an exact published DevTools version exposing this command. When
working on DevTools itself, use ``php bin/dev-tools setup:skills``. The selected
working directory must contain the project's ``composer.json``; use the global
``--working-dir`` option to target another project.

Options
-------

``--dry-run``
Prints the planned commands without executing them. It does not install
packages, generate configuration, fetch skill donors or copy skills.

``--no-sync``
Executes dependency/configuration setup and source registration but omits
the final ``composer skills:update``. Official source registration may still
download and validate donor payloads; this is not an offline mode or dry run.

``--dev-tools-ref=<ref>``
Explicitly chooses the external DevTools GitHub skill ref in a consumer.
Without it, setup uses a 40-character hexadecimal source commit recorded for
the executing DevTools Composer installation. If that metadata is missing
or unsuitable, setup fails before writes and requests an explicit non-empty
ref. Choose a reviewed release commit or supported ref; setup does not fall
back to a moving branch. The DevTools repository uses its local payload and
does not need this external source.

What setup changes
------------------

1. Reads the consumer manifest and checks its existing Composer plugin policy.
An explicit denial of ``llm/skills``, including a matching wildcard or global
false policy, stops setup before mutations. Otherwise setup enables only
the required plugin entry when it is not already allowed.
2. Adds ``llm/skills:^1.15`` to the consumer's ``require-dev`` if neither
dependency section already declares it. Existing constraints and placement,
including a production ``require`` entry, are preserved. If the declared
package is not installed, setup runs Composer install. These dependency
operations disable plugins and scripts and respect ``config.vendor-dir``.
3. If ``skills.json`` is absent, invokes official ``composer skills:init`` in
quick mode with synchronization deferred, target ``.agents/skills``,
Composer trust ``fast-forward/*``, auto-sync enabled and discovery disabled.
The official CLI generates the file; DevTools does not maintain a separate
JSON writer or configuration schema.
4. Registers applicable sources with official ``composer skills:add`` and
synchronization deferred, as described below.
5. Unless ``--no-sync`` is selected, invokes ``composer skills:update`` to copy
the configured skills through LLM Skills.

There is no global installation or addition of LLM Skills to DevTools' core
requirements. The consumer's manifest, lockfile and plugin policy are the
relevant dependency changes; inspect and commit the intended results together.
Installing instructions does not install the external tools they describe.

Source registration
-------------------

.. list-table::
:header-rows: 1

* - Source
- When included
- Ref or location
* - Project-local skills
- Any project with at least one ``SKILL.md`` at the payload root or nested
below it; an absent, empty or unrelated directory is not registered.
- ``./resources/skills`` with ``--from=dir``.
* - External DevTools skills
- Consumer projects, including consumers that also own local skills.
The DevTools repository itself omits this remote source.
- ``php-fast-forward/dev-tools`` at the recorded source commit or explicit
``--dev-tools-ref``.
* - Changelog skills
- Both consumers and the DevTools repository.
- ``php-fast-forward/changelog`` at ``^0.4.0``.

The Changelog constraint admits compatible 0.4.x releases; it is not an exact
commit pin. Subsequent updates follow that selected range through LLM Skills.
A consumer's own local payload complements its external DevTools source rather
than replacing it. Source identity, payload validation and installation metadata
remain owned by the official LLM Skills implementation.

Existing configuration and repeated setup
-----------------------------------------

An existing ``skills.json`` skips initialization; setup never passes ``--force``
to reinitialize it. Official source registration updates matching sources while
preserving their selected skill allowlists and unrelated configuration.
Previously chosen trust and synchronization policies remain in place.

For a new file, LLM Skills 1.15 applies its own defaults and omissions. Its init
options do not expose ``trusted-replace`` or ``vendor-sources`` switches, so
setup does not promise those fields or an exact hand-written JSON layout.
Advanced policy can be reviewed through the official configuration contract;
existing values are not rewritten to match a DevTools template.

Repeat setup to register current payloads and synchronize again. It does not
add another dependency entry when LLM Skills is already declared. Commands stop
on failure, but completed earlier steps may have changed the project. Inspect
``composer.json``, ``composer.lock``, ``skills.json`` and LLM Skills' generated
state before retrying; setup does not claim an atomic rollback across Composer
and network operations.

See :doc:`../usage/syncing-packaged-skills` for ongoing updates and donor
ownership policy. LLM Skills does not synchronize generic workflows, hooks,
metadata or arbitrary project-agent prompts.
12 changes: 10 additions & 2 deletions docs/commands/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ Runs Fast Forward code standards checks.
Description
-----------

The ``standards`` command runs the full quality pipeline:
Without ``dev-tools.json``, ``standards`` retains the full legacy pipeline:

1. ``refactor`` - Rector code refactoring
2. ``phpdoc`` - PHPDoc checks and fixes
3. ``code-style`` - Code style checking
4. ``reports`` - Documentation and test reports

With an explicit :doc:`capability-profiles` selection, ``quality`` enables the
first three phases. Selecting any of ``tests``, ``docs`` or ``metrics`` enables
``reports``, which applies the selected capabilities and project applicability.
``dependencies`` remains an explicit command and does not add a standards
phase. A profile with no standards checks, missing required tools or a report
plan with no applicable checks fails instead of succeeding without execution.

Usage
-----

Expand Down Expand Up @@ -57,7 +64,8 @@ Exit Codes
* - 0
- Success. All checks passed.
* - 1
- Failure. One or more checks failed.
- Failure. A selected check failed, required tools are unavailable, the
profile is invalid or no selected checks apply.

Behavior
---------
Expand Down
Loading
Loading