Skip to content

feat: add category and effect as first-class fields in extension schema#2899

Open
mnriem wants to merge 5 commits into
mainfrom
mnriem/feat-2874-extension-category-effect-fiel
Open

feat: add category and effect as first-class fields in extension schema#2899
mnriem wants to merge 5 commits into
mainfrom
mnriem/feat-2874-extension-category-effect-fiel

Conversation

@mnriem

@mnriem mnriem commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds category and effect as optional fields in the extension schema (extension.yml) and propagates them to catalog.community.json, replacing the manual-only markdown table approach.

Changes

Schema (src/specify_cli/extensions.py)

  • Added VALID_EFFECTS constant for the closed set of allowed effect values
  • Category is free-form (any non-empty string); effect is validated against VALID_EFFECTS
  • Added validation in ExtensionManifest._validate() — raises ValidationError for invalid values when present
  • Added category and effect properties to ExtensionManifest

Catalog (extensions/catalog.community.json)

  • Added category and effect fields to all 108 extension entries (populated from the existing docs table)

CLI (src/specify_cli/__init__.py)

  • specify extension info now displays category and effect for both catalog and local extensions

Template & Docs

  • Updated extensions/template/extension.yml with commented category/effect fields
  • Updated add-community-extension skill with new catalog JSON template
  • Added tip to docs/community/extensions.md noting schema availability

Tests

  • 5 new tests covering valid values, invalid values, and backward compatibility

Extension authors can now declare:

extension:
  id: my-extension
  name: "My Extension"
  category: code          # free-form; common: docs, code, process, integration, visibility
  effect: read-only       # read-only | read-write

Backward Compatibility

Both fields are optional — existing extensions without them continue to work unchanged.

Closes #2874

Add `category` and `effect` as optional fields in the extension schema
(`extension.yml`) and community catalog (`catalog.community.json`).

Schema changes:
- Valid categories: docs, code, process, integration, visibility
- Valid effects: read-only, read-write
- Both fields are optional (backward-compatible with existing extensions)
- Validation raises ValidationError for invalid values when present

Propagation:
- Added `category` and `effect` to all 108 entries in catalog.community.json
  (populated from the existing docs/community/extensions.md table)
- Updated extension template with commented category/effect fields
- Updated add-community-extension skill with new JSON template fields
- Updated `specify extension info` CLI output to display category/effect
- Added properties to ExtensionManifest class

Tests:
- test_valid_category: all 5 category values pass
- test_valid_effect: both effect values pass
- test_invalid_category: invalid value raises ValidationError
- test_invalid_effect: invalid value raises ValidationError
- test_category_and_effect_optional: omitting fields still works

Closes #2874

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 8, 2026 15:33
Category is a free-form string (only validated as non-empty when present),
while effect remains restricted to 'read-only' or 'read-write'.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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 category and effect as optional, first-class fields in the extension manifest schema and surfaces them through the community catalog and CLI so tooling can rely on structured metadata rather than the manually maintained docs table.

Changes:

  • Introduces VALID_CATEGORIES / VALID_EFFECTS, validates extension.category and extension.effect when present, and exposes them via ExtensionManifest properties.
  • Extends specify extension info output (catalog + local) to display category/effect when available.
  • Populates extensions/catalog.community.json with category/effect for community extensions and updates docs/template/skill guidance plus adds new tests.
Show a summary per file
File Description
src/specify_cli/extensions.py Adds allowed-value constants, validates optional manifest fields, and exposes category/effect properties.
src/specify_cli/__init__.py Prints category/effect in specify extension info for local and catalog extensions.
extensions/catalog.community.json Adds category and effect across community catalog entries.
extensions/template/extension.yml Updates the author template to include category/effect guidance.
docs/community/extensions.md Adds a tip explaining the new manifest/catalog fields.
.github/skills/add-community-extension/SKILL.md Updates the community-extension skill template to include category/effect in catalog entries.
tests/test_extensions.py Adds tests for valid/invalid category/effect values and optional/back-compat behavior.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 7/7 changed files
  • Comments generated: 4

Comment thread src/specify_cli/extensions.py Outdated
Comment thread extensions/template/extension.yml Outdated
Comment thread tests/test_extensions.py
Comment thread tests/test_extensions.py
- Add type guard before 'in' check for effect to prevent TypeError on
  unhashable YAML values (list/dict)
- Comment out category/effect in template so authors must opt in
- Use VALID_EFFECTS constant in test instead of hard-coded values

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 8, 2026 15:54

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.

Copilot's findings

  • Files reviewed: 7/7 changed files
  • Comments generated: 2

Comment thread src/specify_cli/extensions.py
Comment thread src/specify_cli/extensions.py
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

Copilot's findings

  • Files reviewed: 7/7 changed files
  • Comments generated: 2

Comment on lines +23 to +24
> [!TIP]
> Extension authors can declare `category` and `effect` in their `extension.yml` under the `extension:` block. These fields are also available in `catalog.community.json` for tooling and the CLI (`specify extension info`).
Comment on lines +92 to +93
**Category** — free-form string; common values: `docs`, `code`, `process`, `integration`, `visibility`
**Effect** — one of: `read-only`, `read-write`
Copilot finished work on behalf of mnriem June 9, 2026 19:34
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 category and effect as first-class fields in the extension schema

3 participants