Skip to content

Commit 0caeac3

Browse files
committed
Refresh README and testing docs
1 parent f803c0e commit 0caeac3

8 files changed

Lines changed: 79 additions & 10 deletions

File tree

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ across Fast Forward libraries.
3535
- Synchronizes packaged skills and project-agent prompts into consumer
3636
`.agents/skills` and `.agents/agents` directories using safe link-based
3737
updates
38+
- Supports guide-only and automation-only repositories by skipping PHPUnit or
39+
wiki generation gracefully when no runnable PHP surface exists
3840
- Works both as a Composer plugin and as a local binary
3941
- Preserves local overrides through consumer-first configuration resolution
4042

@@ -71,6 +73,8 @@ You can also run individual commands for specific development tasks:
7173
```bash
7274
# Run PHPUnit tests
7375
composer dev-tools tests
76+
composer dev-tools tests --json
77+
composer dev-tools tests --pretty-json
7478

7579
# Analyze missing, unused, misplaced, and outdated Composer dependencies
7680
composer dependencies
@@ -120,6 +124,7 @@ composer phpdoc
120124

121125
# Generate HTML API documentation using phpDocumentor
122126
composer docs
127+
composer docs --source=docs/user-guide
123128

124129
# Generate Markdown documentation for the wiki
125130
composer wiki
@@ -180,6 +185,14 @@ The `metrics` command ships with `phpmetrics/phpmetrics` as a direct
180185
dependency of `fast-forward/dev-tools`, so consumer repositories can generate
181186
metrics reports without extra setup.
182187

188+
Guide-only repositories and workflow-only repositories can still use the
189+
packaged command surface. When no runnable PHPUnit surface exists, `tests`
190+
returns a controlled warning instead of failing. When a repository ships
191+
guides without PSR-4 source paths, `docs` builds the guide site without trying
192+
to synthesize API pages. When `.github/wiki` is absent and no wiki has been
193+
initialized yet, `wiki` now skips generation with a warning instead of failing
194+
the whole automation run.
195+
183196
The changelog commands manage Keep a Changelog 1.1.0 files without requiring
184197
extra tooling in the consumer repository. `changelog:entry` bootstraps a
185198
missing changelog file on first use, `changelog:check` enforces meaningful
@@ -215,6 +228,14 @@ takes precedence over terminal-only color. Where orchestrated tools can expose
215228
structured subprocess results safely, DevTools prefers adding stable fields to
216229
the JSON context rather than coloring otherwise strict JSON output.
217230

231+
For the `tests` command, structured runs now capture the bundled PHPUnit
232+
agent-reporter payload inside `context.output` while preserving the normal
233+
DevTools JSON envelope. That means the top-level command still emits one final
234+
document, and consumers can inspect stable nested keys such as
235+
`context.output.result`, `context.output.summary`, optional
236+
`context.output.details`, and `context.output.coverage` when minimum-coverage
237+
validation is active.
238+
218239
Progress output is disabled by default on the commands that support transient
219240
rendering, and `--progress` re-enables it for human-readable terminal runs.
220241
When `--json` or `--pretty-json` is active on commands that orchestrate other

docs/advanced/phpunit-extension.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Runtime Chain
1919
builds a summary notification and sends it when the run finishes.
2020
5. ``Ergebnis\PHPUnit\AgentReporter\Extension`` replaces PHPUnit's normal
2121
output with a compact JSON report when an agent runtime is detected.
22+
6. In structured DevTools runs, ``tests`` forces the same reporter path for
23+
the PHPUnit subprocess so the final nested payload remains deterministic
24+
even when the surrounding process would not naturally look agent-driven.
2225

2326
Why This Helps Consumer Projects
2427
--------------------------------
@@ -29,6 +32,8 @@ Why This Helps Consumer Projects
2932
scrollback;
3033
- agent-driven runs consume far less terminal context while still keeping
3134
failure details and PHPUnit exit semantics intact;
35+
- DevTools can preserve a single top-level JSON document while nesting the
36+
compact PHPUnit summary under ``context.output`` for bot-friendly parsing;
3237
- event counts are available to the notification layer without adding ad-hoc
3338
test code.
3439

docs/commands/docs.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,14 @@ Exit Codes
103103
Behavior
104104
---------
105105

106-
- ``docs/`` must exist unless you pass another ``--source`` directory.
106+
- The default ``docs`` source directory is optional. When it is absent, the
107+
command still generates API pages if PSR-4 source paths are available.
108+
- A custom explicit ``--source`` path must exist; otherwise the command fails
109+
fast.
107110
- API pages are built from the PSR-4 paths declared in ``composer.json``.
108111
- Guide pages are built from the selected source directory.
112+
- Repositories without PSR-4 source paths can still generate a guides-only
113+
site from the selected source directory.
109114
- Cache stays enabled by default; omit both flags to keep the command default,
110115
pass ``--cache`` to force it on, and pass ``--no-cache`` to force it off.
111116
- When ``--cache-dir`` is omitted, phpDocumentor keeps its default cache

docs/commands/reports.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ Behavior
123123
- When ``--json`` or ``--pretty-json`` is active, it forwards JSON mode to the
124124
``docs``, ``tests``, and ``metrics`` subprocesses and suppresses transient
125125
progress output where those tools support it.
126+
- Nested ``docs`` and ``tests`` stages can now skip gracefully with warnings in
127+
guide-only or automation-only repositories, while ``reports`` still returns a
128+
successful aggregate result for the stages that were actually generated.
126129
- Passes ``--junit <coverage>/junit.xml`` to the metrics step.
127130
- Used by the ``standards`` command as the final phase.
128131
- This is the reporting stage used by GitHub Pages.

docs/commands/tests.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ Run with minimum coverage enforcement:
113113
114114
composer tests --min-coverage=80
115115
116+
Run with structured JSON output:
117+
118+
.. code-block:: bash
119+
120+
composer tests --json
121+
composer tests --pretty-json
122+
116123
Run without cache:
117124

118125
.. code-block:: bash
@@ -150,6 +157,10 @@ Behavior
150157
---------
151158

152159
- Local ``phpunit.xml`` is preferred over the packaged default.
160+
- When the default ``tests`` path is absent and the project exposes no
161+
testable PHP source files, the command exits successfully with a warning
162+
instead of failing the whole automation flow.
163+
- A custom explicit tests path that does not exist still fails fast.
153164
- Coverage filters are automatically applied to all PSR-4 paths from composer.json.
154165
- Multiple coverage formats are generated: HTML, Testdox HTML, Clover XML, and PHP.
155166
- Cache stays enabled by default; omit both flags to keep the command default,
@@ -167,6 +178,9 @@ Behavior
167178
command stores that payload inside ``output`` while keeping the standard
168179
DevTools JSON envelope. ``--json`` and ``--pretty-json`` therefore expose
169180
the same structured result, with formatting as the only difference.
181+
- the command forces the bundled PHPUnit agent-reporter extension for
182+
structured runs so the nested payload stays compact and stable even when the
183+
surrounding runtime would not normally look like an agent.
170184
- in structured mode, the command suppresses intermediary ``Running...`` log
171185
records so the output stream contains a single final JSON document.
172186
- when structured capture is active but PHPUnit does not emit parseable JSON,

docs/commands/wiki.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ Behavior
9090
---------
9191

9292
- Default output directory is ``.github/wiki``.
93+
- When the default target does not exist yet and ``--init`` is not requested,
94+
the command skips with a controlled warning instead of failing.
95+
- Repositories without PHP API surface also skip wiki generation with a
96+
warning, because the current wiki renderer only emits API pages.
9397
- Cache stays enabled by default; omit both flags to keep the command default,
9498
pass ``--cache`` to force it on, and pass ``--no-cache`` to force it off.
9599
- When ``--cache-dir`` is omitted, phpDocumentor keeps its default cache

docs/getting-started/quickstart.rst

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ Quickstart
44
This walkthrough is the fastest way to get a new library into a healthy state.
55

66
1. Install the package.
7-
2. Create a minimal guide directory.
7+
2. Create a guide directory if the repository will publish guides.
88
3. Synchronize shared automation, packaged skills, and packaged agents.
99
4. Run the focused commands once.
1010
5. Run the full suite before opening a pull request.
1111

12-
Create the Minimum Guide
13-
------------------------
12+
Optional Guide Setup
13+
--------------------
1414

15-
The ``docs`` command fails early when ``docs/`` does not exist. A tiny
16-
starting page is enough for the first successful run.
15+
If the repository will publish guides, a tiny starting page is enough for the
16+
first successful ``docs`` run.
1717

1818
Create the directory:
1919

@@ -30,10 +30,14 @@ Create ``docs/index.rst`` with content such as:
3030
3131
Welcome to the project documentation.
3232
33+
Repositories that only ship PHP code can skip this step and still generate API
34+
documentation. Repositories that only ship guides can also use the same
35+
``docs`` command even without PSR-4 source paths.
36+
3337
Run the First Commands
3438
----------------------
3539

36-
Once the package is installed and the guide directory exists, run:
40+
Once the package is installed, run:
3741

3842
.. code-block:: bash
3943
@@ -57,9 +61,11 @@ What Each Command Proves
5761
safely into ``.agents/agents`` without copying files into the consumer
5862
repository.
5963
- ``composer tests`` proves the packaged or local PHPUnit
60-
configuration can execute the current test suite.
64+
configuration can execute the current test suite, or skip gracefully when
65+
the repository intentionally has no runnable PHPUnit surface yet.
6166
- ``composer docs`` proves the PSR-4 source paths and the guide
62-
directory are usable by phpDocumentor.
67+
directory are usable by phpDocumentor, whichever of those surfaces the
68+
repository actually provides.
6369
- ``composer dev-tools`` proves the complete pipeline can run in the expected
6470
order.
6571

docs/usage/testing-and-coverage.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ When you run ``tests``, DevTools:
1717
explicit force-off flag for the current run;
1818
- uses the selected workspace ``cache/phpunit`` directory only when caching
1919
stays enabled;
20+
- skips the command with a warning when the repository has no default
21+
``tests`` directory and no testable PHP source surface;
2022
- can generate HTML coverage, Testdox, Clover, and raw PHP coverage output
2123
when ``--coverage`` is provided.
2224

@@ -29,6 +31,8 @@ Useful Examples
2931
composer tests -- --filter=PluginTest
3032
composer tests --coverage=.dev-tools/coverage
3133
composer tests --no-cache --bootstrap=tests/bootstrap.php
34+
composer tests --json
35+
composer tests --pretty-json
3236
3337
Coverage Outputs
3438
----------------
@@ -59,6 +63,10 @@ The packaged ``phpunit.xml`` registers:
5963
default verbose terminal output with a compact JSON summary when an agent
6064
runtime is detected.
6165

66+
When ``tests`` itself runs in structured mode, DevTools also forces the
67+
reporter path for the PHPUnit subprocess so the nested payload remains compact
68+
and parseable for bots and agent workflows.
69+
6270
Programmatic Coverage Access
6371
-----------------------------
6472

@@ -83,7 +91,10 @@ When to Override Locally
8391

8492
Create your own ``phpunit.xml`` in the consumer project when you need a
8593
different bootstrap file, extra extensions, or alternative strictness flags.
86-
DevTools will prefer the local file automatically.
94+
DevTools will prefer the local file automatically, but consumer projects that
95+
replace the packaged configuration must re-register both bundled extensions if
96+
they still want desktop notifications, BypassFinals support, and compact
97+
agent-oriented JSON output.
8798

8899
.. note::
89100

0 commit comments

Comments
 (0)