Skip to content

Commit 1988b19

Browse files
[output] Roll out structured output across commands and workflows (#33) (#146)
* [output] Add initial structured changelog check output (#33) * Update wiki submodule pointer for PR #146 * [tests] Finalize structured output format metadata (#33) * [output] Encapsulate structured responses in a command responder (#33) * Update wiki submodule pointer for PR #146 * [refactor] Clarify command responder naming (#33) * [refactor] Remove legacy resolved responder names (#33) * Update wiki submodule pointer for PR #146 * [output] Expand structured changelog command responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured changelog entry responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured changelog show responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured agents responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured skills responses (#33) * Update wiki submodule pointer for PR #146 * [output] Rename structured output flag and add code-style support (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured refactor responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured phpdoc responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured docs responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured metrics responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured reports responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured standards responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured tests responses (#33) * Update wiki submodule pointer for PR #146 * [output] Add structured sync responses (#33) * Update wiki submodule pointer for PR #146 * Add log output formatter and formatted logger to console. Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com> * [output] Migrate command output handling to logger (#33) * Update wiki submodule pointer for PR #146 * [output] Migrate remaining managed-file commands to logger (#33) * Update wiki submodule pointer for PR #146 * [output] Simplify logger context processing (#33) * Update wiki submodule pointer for PR #146 * [output] Replace output format option with json flag (#33) * Update wiki submodule pointer for PR #146 * [output] Refine json logging defaults and command context (#33) * Update wiki submodule pointer for PR #146 * [output] Quiet nested tool output in json mode (#33) * [docs] Align structured json command documentation (#33) * Update wiki submodule pointer for PR #146 * [ci] Emit GitHub Actions command annotations (#33) * Update wiki submodule pointer for PR #146 * [output] Normalize command result helper usage (#33) * Update wiki submodule pointer for PR #146 * [output] Normalize remaining command result helpers (#33) * Update wiki submodule pointer for PR #146 * [workflow] Group queued command output in GitHub Actions (#33) * Update wiki submodule pointer for PR #146 * [logger] Move GitHub Actions error annotations into logger (#33) * Update wiki submodule pointer for PR #146 * [cli] Invert progress flags and simplify workflow labels (#33) * [tests] Stabilize GitHub Actions output expectations (#33) * [docs] Align output, progress, and workflow guidance (#33) * [review] Preserve resolved docs source in failure logs (#33) * [logger] Make LoggerAwareCommandInterface explicit (#33) * Update wiki submodule pointer for PR #146 * [phpdoc] Restore descriptive command and workflow docs (#33) * Update wiki submodule pointer for PR #146 --------- Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 790bb30 commit 1988b19

109 files changed

Lines changed: 6104 additions & 2693 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/wiki

Submodule wiki updated from 78056a3 to de61917

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add structured command output across the DevTools command surface with `--json` and `--pretty-json`, including pretty-printed JSON and agent-aware JSON defaults (#33)
13+
- Group queued subprocess output and emit GitHub Actions workflow annotations for clearer CI logs and error surfaces (#33)
14+
15+
### Changed
16+
17+
- Propagate structured output flags through nested DevTools subprocesses, simplify logger context extraction, and keep machine-readable runs quieter by default (#33)
18+
- Adopt `--progress` as the positive opt-in for transient progress rendering while keeping supported commands quiet by default (#33)
19+
20+
### Fixed
21+
22+
- Stabilize logger and process-queue test expectations in CI by making GitHub Actions output detection deterministic during the PHPUnit suite (#33)
23+
1024
## [1.16.0] - 2026-04-20
1125

1226
### Changed

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,26 @@ composer --working-dir=packages/example metrics
7676
# Add one changelog entry to Unreleased or a published version
7777
composer changelog:entry "Add changelog automation for release workflows (#28)"
7878
composer changelog:entry --type=fixed --release=1.2.0 --date=2026-04-19 "Preserve published release sections during backfill (#28)"
79+
composer changelog:entry --json "Add changelog automation for release workflows (#28)"
80+
composer changelog:entry --pretty-json "Add changelog automation for release workflows (#28)"
7981

8082
# Verify that the current branch added a meaningful Unreleased entry
8183
composer changelog:check
8284
composer changelog:check --against=origin/main
85+
composer changelog:check --json
86+
composer changelog:check --pretty-json
8387

8488
# Infer the next semantic version from Unreleased
8589
composer changelog:next-version
90+
composer changelog:next-version --json
8691

8792
# Promote Unreleased into a published version
8893
composer changelog:promote 1.3.0
94+
composer changelog:promote 1.3.0 --json
8995

9096
# Render one published section as release notes
9197
composer changelog:show 1.3.0
98+
composer changelog:show 1.3.0 --json
9299

93100
# Check and fix code style using ECS and Composer Normalize
94101
composer code-style
@@ -168,6 +175,27 @@ next semantic version from pending changes, `changelog:promote` publishes the
168175
current `Unreleased` section into a tagged version, and `changelog:show`
169176
renders one published section for GitHub release notes.
170177

178+
Structured output is available across the DevTools command surface through
179+
`--json`, which returns deterministic `message` / `level` / `context` payloads
180+
for CI, bots, and AI-agent workflows while preserving the normal
181+
human-readable terminal output by default. Use `--pretty-json` when you want
182+
the same structured payload indented for manual inspection in a terminal.
183+
`--pretty-json` also implies JSON output, so there is no need to pass both
184+
flags together. In agent environments, DevTools can also switch to JSON
185+
automatically when the runtime is detected as agent-driven. For
186+
`changelog:show`, the default text mode still prints the raw release-notes
187+
body so release workflows can keep piping it directly into GitHub releases.
188+
189+
Progress output is disabled by default on the commands that support transient
190+
rendering, and `--progress` re-enables it for human-readable terminal runs.
191+
When `--json` or `--pretty-json` is active on commands that orchestrate other
192+
tools, DevTools keeps progress suppressed, forwards JSON flags where the
193+
underlying tool supports structured output, and otherwise falls back to
194+
quieter subprocess modes so the captured payload stays machine-readable. In
195+
GitHub Actions, queued subprocess output is grouped into collapsible sections,
196+
and logged failures emit native workflow error annotations, including file and
197+
line metadata when commands provide it.
198+
171199
When the packaged changelog workflow is synchronized into a consumer
172200
repository, pull requests are expected to add a notable changelog entry before
173201
merge. The same workflow can be triggered manually to prepare a release bump

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"composer/composer": "^2.9",
4545
"container-interop/service-provider": "^0.4.1",
4646
"dg/bypass-finals": "^1.9",
47+
"ergebnis/agent-detector": "^1.1",
4748
"ergebnis/composer-normalize": "^2.51",
4849
"ergebnis/rector-rules": "^1.18",
4950
"fakerphp/faker": "^1.24",

docs/commands/agents.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ Usage
2020
Options
2121
-------
2222

23-
This command does not accept additional options.
23+
This command supports:
24+
25+
- ``--json`` to emit a structured machine-readable payload instead of the
26+
normal terminal output;
27+
- ``--pretty-json`` to emit the same structured payload with indentation for
28+
terminal inspection.
2429

2530
Examples
2631
--------

docs/commands/changelog.rst

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,21 @@ Usage
3131
3232
composer changelog:entry "Add changelog automation for release workflows (#28)"
3333
composer changelog:entry --type=fixed --release=1.2.0 --date=2026-04-19 "Preserve published release sections during backfill (#28)"
34+
composer changelog:entry --json "Add changelog automation for release workflows (#28)"
3435
3536
composer changelog:check
3637
composer changelog:check --against=origin/main
38+
composer changelog:check --json
3739
3840
composer changelog:next-version
41+
composer changelog:next-version --json
3942
4043
composer changelog:promote 1.3.0
4144
composer changelog:promote 1.3.0 --date=2026-04-19
45+
composer changelog:promote 1.3.0 --json
4246
4347
composer changelog:show 1.3.0
48+
composer changelog:show 1.3.0 --json
4449
4550
Options
4651
-------
@@ -55,34 +60,54 @@ Options
5560
- ``--date=<YYYY-MM-DD>`` when a published section should carry a release
5661
date immediately;
5762
- ``--file=<path>`` to work with a changelog file other than
58-
``CHANGELOG.md``.
63+
``CHANGELOG.md``;
64+
- ``--json`` to emit a structured machine-readable payload instead of the
65+
normal terminal output;
66+
- ``--pretty-json`` to emit the same structured payload with indentation for
67+
terminal inspection.
5968

6069
``changelog:check``
6170
Supports:
6271

6372
- ``--against=<git-ref>`` to compare the current changelog against a base
6473
branch or commit;
65-
- ``--file=<path>`` to validate another changelog path.
74+
- ``--file=<path>`` to validate another changelog path;
75+
- ``--json`` to emit a structured machine-readable payload instead of the
76+
normal terminal output;
77+
- ``--pretty-json`` to emit the same structured payload with indentation for
78+
terminal inspection.
6679

6780
``changelog:next-version``
6881
Supports:
6982

7083
- ``--current-version=<semver>`` when the current published version should
7184
be supplied explicitly instead of inferred from the changelog;
72-
- ``--file=<path>`` to inspect another changelog path.
85+
- ``--file=<path>`` to inspect another changelog path;
86+
- ``--json`` to emit a structured machine-readable payload instead of the
87+
normal terminal output;
88+
- ``--pretty-json`` to emit the same structured payload with indentation for
89+
terminal inspection.
7390

7491
``changelog:promote``
7592
Supports:
7693

7794
- the required version argument;
7895
- ``--date=<YYYY-MM-DD>`` to control the published release date;
79-
- ``--file=<path>`` to promote another changelog path.
96+
- ``--file=<path>`` to promote another changelog path;
97+
- ``--json`` to emit a structured machine-readable payload instead of the
98+
normal terminal output;
99+
- ``--pretty-json`` to emit the same structured payload with indentation for
100+
terminal inspection.
80101

81102
``changelog:show``
82103
Supports:
83104

84105
- the required version argument;
85-
- ``--file=<path>`` to render another changelog path.
106+
- ``--file=<path>`` to render another changelog path;
107+
- ``--json`` to emit a structured machine-readable payload instead of the
108+
raw release-note text;
109+
- ``--pretty-json`` to emit the same structured payload with indentation for
110+
terminal inspection.
86111

87112
Behavior
88113
--------
@@ -91,13 +116,27 @@ Behavior
91116
when the selected file does not exist yet;
92117
- ``changelog:check`` returns a failing exit code when ``Unreleased`` is empty
93118
or does not differ from the selected baseline ref;
119+
- ``changelog:entry --json`` emits the authoring summary as the
120+
``message`` plus structured context describing the file, category, release,
121+
optional date, and entry text;
122+
- ``changelog:check --json`` emits a deterministic JSON payload with
123+
``status``, ``message``, and ``context`` keys for automation consumers;
124+
- ``changelog:next-version --json`` emits the inferred semantic version
125+
as the ``message`` plus structured context describing the inspected changelog
126+
path and optional current version;
94127
- ``changelog:next-version`` uses ``Removed`` or ``Deprecated`` entries for a
95128
major bump, ``Added`` or ``Changed`` entries for a minor bump, and otherwise
96129
falls back to a patch bump;
130+
- ``changelog:promote --json`` emits the promotion summary as the
131+
``message`` plus structured context describing the file, version, and
132+
release date written to the changelog;
97133
- ``changelog:promote`` restores an empty ``Unreleased`` section after
98134
publishing the requested version;
99-
- ``changelog:show`` prints only the release body so workflows can feed it
100-
directly into GitHub release notes.
135+
- ``changelog:show`` prints only the release body in text mode so workflows can
136+
feed it directly into GitHub release notes;
137+
- ``changelog:show --json`` emits the rendered release-notes body as the
138+
``message`` plus structured context describing the file, version, and
139+
release notes content.
101140

102141
Workflow Integration
103142
--------------------

docs/commands/code-style.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ Options
3131
``--fix, -f``
3232
Automatically fix code style issues. Without this option, ECS runs in dry-run mode.
3333

34+
``--progress``
35+
Enable progress output from ECS.
36+
37+
``--json``
38+
Emit a structured machine-readable payload instead of the normal terminal
39+
output.
40+
41+
``--pretty-json``
42+
Emit the same structured payload with indentation for terminal inspection.
43+
3444
Examples
3545
--------
3646

@@ -66,4 +76,8 @@ Behavior
6676
- Always runs ``composer update --lock --quiet`` first.
6777
- Composer Normalize runs in ``--dry-run`` mode unless ``--fix`` is specified.
6878
- ECS uses local ``ecs.php`` when present, otherwise falls back to packaged default.
79+
- Progress output is disabled by default; use ``--progress`` to re-enable it in
80+
text mode.
81+
- ``--json`` and ``--pretty-json`` forward JSON mode to ECS and suppress its
82+
progress bar so the structured payload stays machine-readable.
6983
- The command executes processes in sequence via ProcessQueue.

docs/commands/codeowners.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ Options
4040
Prompt for owners when metadata inference is insufficient and confirm before
4141
replacing an existing file.
4242

43+
``--json``
44+
Emit a structured machine-readable payload instead of the normal terminal
45+
output.
46+
47+
``--pretty-json``
48+
Emit the same structured payload with indentation for terminal inspection.
49+
4350
Examples
4451
--------
4552

docs/commands/copy-resource.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ Options
5050
``--interactive``
5151
Prompt before replacing a drifted resource.
5252

53+
``--json``
54+
Emit a structured machine-readable payload instead of the normal terminal
55+
output.
56+
57+
``--pretty-json``
58+
Emit the same structured payload with indentation for terminal inspection.
59+
5360
Examples
5461
--------
5562

docs/commands/dependencies.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ Options
5555
Asks ``composer-dependency-analyser`` to dump usages for the given package
5656
or wildcard pattern and enables ``--show-all-usages`` automatically.
5757

58+
``--json``
59+
Emit a structured machine-readable payload instead of the normal terminal
60+
output.
61+
62+
``--pretty-json``
63+
Emit the same structured payload with indentation for terminal inspection.
64+
5865
Examples
5966
--------
6067

0 commit comments

Comments
 (0)