Skip to content

feat: add JSON output to preset and extension lists - #4218

Open
WOLIKIMCHENG wants to merge 2 commits into
github:mainfrom
WOLIKIMCHENG:feat/4211-json-list-output
Open

feat: add JSON output to preset and extension lists#4218
WOLIKIMCHENG wants to merge 2 commits into
github:mainfrom
WOLIKIMCHENG:feat/4211-json-list-output

Conversation

@WOLIKIMCHENG

Copy link
Copy Markdown
Contributor

Description

Add --json output to specify preset list and specify extension list.

The new output provides a consistent installed-item schema with per-kind
contribution counts, normalized local/catalog source kinds, and nullable
authors. Existing text output and preset precedence ordering remain unchanged.

In JSON mode, extension list --available and --all continue to return
installed extensions only.

Closes #4211

Testing

  • .venv/bin/python -m pytest -p no:cacheprovider tests/test_installed_list_json.py tests/test_init_dir_cli.py -q — 25 passed
  • .venv/bin/specify preset list --help
  • .venv/bin/specify extension list --help
  • git diff --check

@WOLIKIMCHENG
WOLIKIMCHENG requested a review from mnriem as a code owner August 20, 2026 09:22
@mnriem
mnriem requested a balanced review from Copilot August 20, 2026 12:54
@mnriem mnriem self-assigned this Aug 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds machine-readable JSON output for installed preset and extension listings.

Changes:

  • Adds --json CLI output and structured error responses.
  • Adds contribution counts, authors, sources, and precedence ordering.
  • Adds documentation and contract tests.

Structured catalog provenance is currently lost because only source.kind is emitted.

Show a summary per file
File Description
src/specify_cli/_installed_list_json.py Defines the shared JSON schema and emitters.
src/specify_cli/_project.py Adds non-rendering project resolution.
src/specify_cli/presets/_commands.py Adds preset JSON listing.
src/specify_cli/presets/__init__.py Computes preset JSON metadata.
src/specify_cli/extensions/_commands.py Adds extension JSON listing.
src/specify_cli/extensions/__init__.py Computes extension JSON metadata.
tests/test_installed_list_json.py Tests JSON contracts and failures.
docs/reference/presets.md Documents preset JSON output.
docs/reference/extensions.md Documents extension JSON output.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread src/specify_cli/_installed_list_json.py Outdated
"author": record["_json_author"],
"priority": record["priority"],
"enabled": record["enabled"],
"source": {"kind": record["_json_source_kind"]},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 1e4f38c2: structured catalog sources are now preserved, with safe fallback for legacy or malformed records. Added regression coverage; 17 focused and 1138 related tests pass locally.

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address Copilot feedback

@mnriem mnriem removed their assignment Aug 20, 2026
Preserve valid catalog provenance in installed preset and extension JSON output while retaining the local fallback for missing, legacy, unknown, and malformed records.

Carry raw registry source metadata through healthy and corrupt manager records, whitelist the public kind/catalog shape in the shared adapter, and document and test the contract without changing provenance producers.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/specify_cli/presets/_commands.py:64

  • The new machine-readable ordering contract is not exercised: the only JSON preset test installs one item, while the existing multi-preset precedence tests invoke only the text branch. Add a JSON test with reversed installation/priority order and an equal-priority ID tie so consumers can rely on the promised (priority, id) array order.
            installed = sorted(
                installed,
                key=lambda pack: (pack.get("priority", 10), str(pack.get("id", ""))),
            )
  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Balanced

"author": record["_json_author"],
"priority": record["priority"],
"enabled": record["enabled"],
"source": _normalized_source(record["_json_source"]),
@mnriem

mnriem commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Please address Copilot feedback

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.

[Feature]: Add --json output to preset list and extension list

3 participants