Skip to content

Support grouped template selection and repository configuration format#158

Merged
ericof merged 6 commits intomainfrom
issues_118-128-141
Apr 3, 2026
Merged

Support grouped template selection and repository configuration format#158
ericof merged 6 commits intomainfrom
issues_118-128-141

Conversation

@ericof
Copy link
Copy Markdown
Member

@ericof ericof commented Apr 2, 2026

Summary

  • Implements cookieplone-config.json repository configuration format with JSON Schema validation, grouped templates, global version pinning, and backward-compatible fallback to cookiecutter.json.
  • Adds two-step grouped template selection in the CLI: users first pick a category, then a template within that category. Flat template lists are still supported for repos without groups.
  • Supports global version pinning from repository config, applied as default context to all templates.
  • Increases test coverage for utils/console.py (52%→99%), utils/cookiecutter.py (67%→100%), utils/parsers.py (50%→100%), and utils/plone.py (70%→97%).
  • Documents that the default branch for cookieplone-templates is next.

Closes #118
Closes #128
Closes #141
Closes #159
Closes #160
Closes #161

Test plan

  • Run make test — all 790 tests pass
  • Run make test-coverage — overall coverage at 88%
  • Run make lint — all checks pass
  • Run uvx --from git+https://github.com/plone/cookieplone@issues_118-128-141 cookieplone
    • Verify grouped selection with a repository that uses cookieplone-config.json with groups
  • Run COOKIEPLONE_REPOSITORY_TAG=main uvx --from git+https://github.com/plone/cookieplone@issues_118-128-141 cookieplone
    • Verify flat template selection with a legacy repository using cookiecutter.json
  • Verify --no-input still works for non-interactive generation

ericof added 4 commits April 1, 2026 17:44
Add a new repository-level configuration format with JSON Schema
validation, grouped templates, global version pinning, and
backward-compatible fallback to cookiecutter.json.

- Refactor schemas.py into a schemas/ package with standalone JSON
  schema files (reusable for future pytest-jsonschema package)
- Add repository_config.schema.json with structural validation
- Add cross-referential validation (groups ↔ templates consistency)
- Update get_repository_config() to prefer new format with validation
- Add documentation for the new format
- Add comprehensive test coverage (repository schema + loading logic)

Closes #141
Read `config.versions` from the repository-level `cookieplone-config.json`
and merge it as a base layer into each template's versions context.
Per-template versions override global values for the same key, so
templates can still customise individual pins while inheriting shared
defaults via `{{ versions.<key> }}`.

Closes #128
When cookieplone-config.json defines groups, the CLI presents a two-step
selection: first a category, then a template within that category. Legacy
repos without groups fall back to the flat template list. The display uses
styled numbered lists inside labeled panels instead of tables.

Also updates the default repository tag from main to next and documents
the change in the relevant docs pages.

Closes #118
- console.py: 52% → 99%
- cookiecutter.py: 67% → 100%
- parsers.py: 50% → 100%
- plone.py: 70% → 97%
@ericof ericof requested a review from a team as a code owner April 2, 2026 02:10
@ericof ericof requested review from avoinea and valentinab25 April 2, 2026 02:10
@ericof
Copy link
Copy Markdown
Member Author

ericof commented Apr 2, 2026

@valentinab25 Please, take a look at this PR, as it is going to be the basis to the extension mechanism

@valentinab25
Copy link
Copy Markdown

Created #159 and #160 while testing the review/go back features.

ericof added 2 commits April 2, 2026 08:57
Add xfail tests that reproduce issues #159 (go-back loses user-entered
values) and #160 (computed fields stale after review retry). Both bugs
are in tui-forms' BaseRenderer; the xfail markers will be removed once
the upstream fixes land.
@ericof
Copy link
Copy Markdown
Member Author

ericof commented Apr 2, 2026

@valentinab25 I believe those two are now fixed

Copy link
Copy Markdown

@valentinab25 valentinab25 left a comment

Choose a reason for hiding this comment

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

I have compared the generation on all templates with this branch and they are generated exactly the same, with the exception of the new .cookieplone.json file.
I have tested the "go back" and "review" features and they are now working correctly

@ericof ericof merged commit c81027d into main Apr 3, 2026
10 checks passed
@ericof ericof deleted the issues_118-128-141 branch April 3, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants