-
-
Notifications
You must be signed in to change notification settings - Fork 119
feat(ext.generate): unify features into typed variables (#782) #783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b3cd713
db2c417
e9677e2
fcbfe4f
b0d0ae7
0a1f030
5c50802
8d7855e
f01e540
c230103
6d52b2e
e9bd529
a7597c5
d60766e
1f0987e
e594f90
7700043
533ca5b
fb142bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -157,6 +157,12 @@ Bugs: | |||||||||||||||||||||||||||||||||||
| with a `name`-match guard, so transitive `ModuleNotFoundError`s | ||||||||||||||||||||||||||||||||||||
| raised inside the user's template module propagate normally | ||||||||||||||||||||||||||||||||||||
| instead of being silently swallowed as "module not found" | ||||||||||||||||||||||||||||||||||||
| - `[ext.generate]` `type: boolean` template variables now emit a real | ||||||||||||||||||||||||||||||||||||
| Python bool at the top level of the render context (`data[name]`), | ||||||||||||||||||||||||||||||||||||
| so `{% if feature_x %}` works in jinja2/mustache; the boolean prompt | ||||||||||||||||||||||||||||||||||||
| uses a vars-style `[(Y)es/(N)o] [default]:` format and all variables | ||||||||||||||||||||||||||||||||||||
| prompt in a single declaration-order pass — resolves #782 (the | ||||||||||||||||||||||||||||||||||||
| former `features:` namespace and pre-pass are removed) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Features: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -181,9 +187,53 @@ Features: | |||||||||||||||||||||||||||||||||||
| variables). `prompt_mode` defaults to `boolean` (legacy behavior, | ||||||||||||||||||||||||||||||||||||
| byte-identical when key absent). | ||||||||||||||||||||||||||||||||||||
| - [Issue #779](https://github.com/datafolklabs/cement/issues/779) | ||||||||||||||||||||||||||||||||||||
| - `[ext.generate]` Add `type: choice` template variables — a numbered | ||||||||||||||||||||||||||||||||||||
| `cement.utils.shell.Prompt` picker that emits the chosen option string | ||||||||||||||||||||||||||||||||||||
| at the top level of the render context. `options:` accepts a scalar | ||||||||||||||||||||||||||||||||||||
| list or per-option `{value, prompt}` objects; per-option effects live | ||||||||||||||||||||||||||||||||||||
| in `extend:` rules keyed by `when: <value>`. Misconfig (empty options, | ||||||||||||||||||||||||||||||||||||
| option missing `value`, default not in options, duplicate labels) is | ||||||||||||||||||||||||||||||||||||
| fail-fast `ValueError`. | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+190
to
+196
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consolidate to a single-line CHANGELOG entry. This feature entry spans 7 lines. Per coding guidelines, each CHANGELOG entry must be one line. As per coding guidelines: "Each CHANGELOG.md entry must be one line, prefixed with Example consolidation-- `[ext.generate]` Add `type: choice` template variables — a numbered
- `cement.utils.shell.Prompt` picker that emits the chosen option string
- at the top level of the render context. `options:` accepts a scalar
- list or per-option `{value, prompt}` objects; per-option effects live
- in `extend:` rules keyed by `when: <value>`. Misconfig (empty options,
- option missing `value`, default not in options, duplicate labels) is
- fail-fast `ValueError`.
+- `[ext.generate]` Add `type: choice` variables with numbered picker; emits string at top level; `extend:` rules per option; fail-fast validation📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| - `[ext.generate]` `type: boolean` `prompt:` is now polymorphic — | ||||||||||||||||||||||||||||||||||||
| in addition to the framework-owned string form and the silent | ||||||||||||||||||||||||||||||||||||
| `prompt: false` form, an object form `{text, accept, reject}` lets the | ||||||||||||||||||||||||||||||||||||
| template author own the full prompt text and supply case-insensitive | ||||||||||||||||||||||||||||||||||||
| `accept:`/`reject:` token lists that map input to a real bool. Input | ||||||||||||||||||||||||||||||||||||
| matching neither asserts and aborts (`Invalid Response`), mirroring | ||||||||||||||||||||||||||||||||||||
| `validate:`. A bool-like `accept:`/`reject:` token that YAML 1.1 | ||||||||||||||||||||||||||||||||||||
| coerced to a Python bool raises `ValueError` telling the author to | ||||||||||||||||||||||||||||||||||||
| quote it. | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+197
to
+205
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consolidate to a single-line CHANGELOG entry. This feature entry spans 9 lines. Per coding guidelines, each CHANGELOG entry must be one line. As per coding guidelines: "Each CHANGELOG.md entry must be one line, prefixed with Example consolidation-- `[ext.generate]` `type: boolean` `prompt:` is now polymorphic —
- in addition to the framework-owned string form and the silent
- `prompt: false` form, an object form `{text, accept, reject}` lets the
- template author own the full prompt text and supply case-insensitive
- `accept:`/`reject:` token lists that map input to a real bool. Input
- matching neither asserts and aborts (`Invalid Response`), mirroring
- `validate:`. A bool-like `accept:`/`reject:` token that YAML 1.1
- coerced to a Python bool raises `ValueError` telling the author to
- quote it.
+- `[ext.generate]` `type: boolean` `prompt:` supports object form `{text, accept, reject}` for custom tokens; YAML 1.1 bool-coercion guard📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| - `[ext.generate]` `extend.when` now composes three match forms — a | ||||||||||||||||||||||||||||||||||||
| scalar value (equality), an in-list membership (`when: [a, b]`), and a | ||||||||||||||||||||||||||||||||||||
| string-type regex (`re.match`, string variables only) — and multiple | ||||||||||||||||||||||||||||||||||||
| matching rules all fire, accumulating their `variables`/`exclude`/ | ||||||||||||||||||||||||||||||||||||
| `ignore`. `extend.variables` are nested and prompted depth-first in | ||||||||||||||||||||||||||||||||||||
| place only when their parent rule fires. A new top-level `requires:` | ||||||||||||||||||||||||||||||||||||
| key gates a variable using the same match vocabulary (`[name]` → | ||||||||||||||||||||||||||||||||||||
| truthy, `{name: value}` → equality, `{name: [v1, v2]}` → in-list), | ||||||||||||||||||||||||||||||||||||
| AND-ed across keys and resolved order-independently via lazy | ||||||||||||||||||||||||||||||||||||
| recursion. A requires-gated-out variable is set to its `default` (so | ||||||||||||||||||||||||||||||||||||
| templates never `KeyError`) and its `extend` rules do not fire. The | ||||||||||||||||||||||||||||||||||||
| unified schema also addresses the PR #780 review feedback: features | ||||||||||||||||||||||||||||||||||||
| prompt after vars in declaration order, with custom per-feature | ||||||||||||||||||||||||||||||||||||
| prompt text and vars-style input. | ||||||||||||||||||||||||||||||||||||
| - [Issue #782](https://github.com/datafolklabs/cement/issues/782) | ||||||||||||||||||||||||||||||||||||
| - [PR #780](https://github.com/datafolklabs/cement/pull/780) | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+206
to
+221
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consolidate to a single-line CHANGELOG entry. This feature entry spans 16 lines. Per coding guidelines, each CHANGELOG entry must be one line. As per coding guidelines: "Each CHANGELOG.md entry must be one line, prefixed with Example consolidation-- `[ext.generate]` `extend.when` now composes three match forms — a
- scalar value (equality), an in-list membership (`when: [a, b]`), and a
- string-type regex (`re.match`, string variables only) — and multiple
- matching rules all fire, accumulating their `variables`/`exclude`/
- `ignore`. `extend.variables` are nested and prompted depth-first in
- place only when their parent rule fires. A new top-level `requires:`
- key gates a variable using the same match vocabulary (`[name]` →
- truthy, `{name: value}` → equality, `{name: [v1, v2]}` → in-list),
- AND-ed across keys and resolved order-independently via lazy
- recursion. A requires-gated-out variable is set to its `default` (so
- templates never `KeyError`) and its `extend` rules do not fire. The
- unified schema also addresses the PR `#780` review feedback: features
- prompt after vars in declaration order, with custom per-feature
- prompt text and vars-style input.
- - [Issue `#782`](https://github.com/datafolklabs/cement/issues/782)
- - [PR `#780`](https://github.com/datafolklabs/cement/pull/780)
+- `[ext.generate]` `extend.when` supports scalar/list/regex matching; multiple rules compose; new `requires:` gates variables with default fallback — `#782`, PR `#780`📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Refactoring: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - `[ext.generate]` Remove the unreleased `features:` schema | ||||||||||||||||||||||||||||||||||||
| (`prompt_mode`, `enabled:`/`disabled:` blocks, select `options:` | ||||||||||||||||||||||||||||||||||||
| effects) wholesale — everything it expressed is now a `type: | ||||||||||||||||||||||||||||||||||||
| boolean`/`type: choice` variable carrying `extend:`/`requires:`. The | ||||||||||||||||||||||||||||||||||||
| legacy compatibility bridge is deleted; `features:` is no longer read | ||||||||||||||||||||||||||||||||||||
| by the engine (#782). | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+225
to
+230
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consolidate to a single-line CHANGELOG entry. This refactoring entry spans 6 lines. Per coding guidelines, each CHANGELOG entry must be one line. As per coding guidelines: "Each CHANGELOG.md entry must be one line, prefixed with Example consolidation-- `[ext.generate]` Remove the unreleased `features:` schema
- (`prompt_mode`, `enabled:`/`disabled:` blocks, select `options:`
- effects) wholesale — everything it expressed is now a `type:
- boolean`/`type: choice` variable carrying `extend:`/`requires:`. The
- legacy compatibility bridge is deleted; `features:` is no longer read
- by the engine (`#782`).
+- `[ext.generate]` Remove unreleased `features:` schema; replaced by typed variables with `extend:`/`requires:` — `#782`🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - `[dev]` Migrate the `demo/generate-features/` webapp template to the | ||||||||||||||||||||||||||||||||||||
| unified `type:`/`extend:`/`requires:` schema (off the removed | ||||||||||||||||||||||||||||||||||||
| `features:` schema) and demonstrate the #782 fix — `{% if docker %}` | ||||||||||||||||||||||||||||||||||||
| and `{% if web_framework == ... %}` now render against the top-level | ||||||||||||||||||||||||||||||||||||
| bool/choice exposure | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+232
to
+236
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consolidate to a single-line CHANGELOG entry. This refactoring entry spans 5 lines. Per coding guidelines, each CHANGELOG entry must be one line. As per coding guidelines: "Each CHANGELOG.md entry must be one line, prefixed with Example consolidation-- `[dev]` Migrate the `demo/generate-features/` webapp template to the
- unified `type:`/`extend:`/`requires:` schema (off the removed
- `features:` schema) and demonstrate the `#782` fix — `{% if docker %}`
- and `{% if web_framework == ... %}` now render against the top-level
- bool/choice exposure
+- `[dev]` Migrate `demo/generate-features/` to unified typed variable schema; demonstrates `#782` top-level bool/choice exposure📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| - `[ext.smtp]` PEP 8 naming, idiomatic string methods, and cleaner type validation | ||||||||||||||||||||||||||||||||||||
| - `[ext.smtp]` Refactor `_make_message` into focused private methods | ||||||||||||||||||||||||||||||||||||
| - `[ext.smtp]` Simplify X-header normalization and preserve original casing | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consolidate to a single-line CHANGELOG entry.
CHANGELOG entries must be one line per the coding guidelines. This entry spans 6 lines. Condense the description or move detail to issue/PR discussions.
As per coding guidelines: "Each CHANGELOG.md entry must be one line, prefixed with
[area]".Example consolidation
📝 Committable suggestion
🤖 Prompt for AI Agents