Add --category to marketplace package add/set - #2626
Open
Tech Guy (lukiod) wants to merge 1 commit into
Open
Conversation
Marketplace manifest entries already support a category field (read, validated, and emitted by the existing schema/output code), but the CLI only exposed --tags, forcing manual apm.yml edits for categories. Adds --category to both commands, mirroring the existing --tags plumbing, with the same non-empty validation the schema already enforces on read.
Tech Guy (lukiod)
requested review from
Daniel Meppiel (danielmeppiel) and
Sergio Sisternes (sergio-sisternes-epam)
as code owners
August 19, 2026 12:25
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for a category field on marketplace plugin entries, including CLI flags, YAML editing logic, validation, and unit tests.
Changes:
- Introduces
categoryoption toplugin addandplugin setcommands. - Adds
categoryto marketplace YAML add/update flows with validation. - Expands unit tests to cover
categorypersistence and blank-category errors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/unit/marketplace/test_yml_editor.py | Adds assertions and new tests for category handling in add/update flows. |
| src/apm_cli/marketplace/yml_editor.py | Adds _validate_category and wires category into add/update entry logic. |
| src/apm_cli/commands/marketplace/plugin/set.py | Adds --category flag and passes it through to update fields. |
| src/apm_cli/commands/marketplace/plugin/add.py | Adds --category flag and passes it through to entry creation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+154
to
+157
| def _validate_category(category: str) -> None: | ||
| """Validate *category* is a non-empty string.""" | ||
| if not isinstance(category, str) or not category.strip(): | ||
| raise MarketplaceYmlError("'category' must be a non-empty string") |
Comment on lines
+238
to
+239
| if category is not None: | ||
| new_entry["category"] = category |
Comment on lines
285
to
289
| if key == "subdir": | ||
| _validate_subdir(fields[key]) | ||
| elif key == "category": | ||
| _validate_category(fields[key]) | ||
| entry[key] = fields[key] |
Contributor
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2625.
Marketplace manifest entries already support a
categoryfield — the schema validates it (yml_schema.py, "must be a non-empty string") and the output mappers already emit it (output_mappers.py), per the issue's own description. The CLI only exposed--tags, so getting a category intomarketplace.packages[]required a manualapm.ymledit.Adds
--category TEXTto bothapm marketplace package addandapm marketplace package set, mirroring the existing--tagsplumbing throughyml_editor.py'sadd_plugin_entry/update_plugin_entry, with the same non-empty validation the schema already enforces on read (so an invalid/blank value fails immediately with an actionable message rather than persisting bad data that only fails later oncheck).Verified end-to-end manually (
marketplace package add ... --category "Productivity"persists correctly;--category " "fails with'category' must be a non-empty string), plus new unit tests intest_yml_editor.pycovering both the happy path and the validation error foraddandset. Full marketplace test suite: 1511 passed.ruff checkclean on all changed files.Acceptance criteria from the issue:
--categorymarketplace.packages[]apm marketplace checkandapm packpreserve and emit category (already worked once present — pre-existing code, not touched here)