Skip to content

feat(upgrade): report each step's outcome as JSON for a program driving the upgrade - #66

Merged
imorland merged 1 commit into
3.xfrom
im/upgrade-json
Oct 16, 2026
Merged

imorland merged 1 commit into
3.xfrom
im/upgrade-json

Conversation

@imorland

Copy link
Copy Markdown
Member

Fixes: no issue.

Changes proposed in this pull request:
upgrade 2.0 --json lets another program, such as an AI agent, drive the upgrade. It asks nothing (it implies -n) and prints one JSON object when it finishes, exiting non-zero if the upgrade didn't complete. For each step the object gives its status (committed, no-changes, skipped, failed or not-run). A committed step adds its commit, its manual-work notes and the @TODOs its commit added. A failed step lists the files it couldn't upgrade, each with the reason. Errors from before any step come back in the same shape.

Without --json, output that isn't going to a terminal no longer has cursor codes or spinner lines. The API resource stub's @todo is now @TODO, like every other marker, and a stray console.log in the frontend misc step is gone because it would break the JSON. The README now documents upgrade.

Reviewers should focus on:

  • TODOs are read from each step's commit diff. A TODO line that the commit only reformatted or moved isn't counted, so the extension's own TODOs stay out of the list.

Screenshot
N/A

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered? (N/A)
  • For core PRs, does this need to be in core, or could it be in an extension? (N/A)
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation. (The built CLI ran upgrade 2.0 --json on a real 1.x extension.)
  • Frontend changes: tests are green (run yarn test in js/).
  • Frontend changes: tests have been added, or are not appropriate here.
  • Backend changes: tests are green (run composer test). (N/A)
  • Backend changes: tests have been added, or are not appropriate here. (N/A)
  • Where applicable, changes are suitable for all supported database drivers (MySQL, MariaDB, PostgreSQL, SQLite). (N/A)
  • Core developer confirmed locally this works as intended.
  • The description above is written by me and describes what this pull request actually does.

@imorland
imorland marked this pull request as ready for review October 16, 2026 07:43
@imorland
imorland merged commit 1b0ffbc into 3.x Oct 16, 2026
3 checks passed
@imorland
imorland deleted the im/upgrade-json branch October 16, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant