Skip to content

feat(cli): Rails-style column size modifiers for generators - #3560

Merged
bpamiri merged 3 commits into
developfrom
cursor/cli-column-size-modifiers-13b9
Sep 9, 2026
Merged

feat(cli): Rails-style column size modifiers for generators#3560
bpamiri merged 3 commits into
developfrom
cursor/cli-column-size-modifiers-13b9

Conversation

@bpamiri

@bpamiri bpamiri commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

CLI generators (model, scaffold, api-resource) now accept Rails-style column size modifiers on property tokens:

wheels generate scaffold Post 'title:string{50}' 'price:decimal{10,2}' body:text
wheels generate model Product 'name:string{80}' 'amount:decimal{12,4}'

Generated migrations emit the custom limit / precision / scale instead of the hardcoded defaults (string 255, integer 11, decimal 10/2).

Related Issue

N/A — requested as a v1 generator enhancement.

Type of Change

  • New feature
  • Documentation update

Behavior

Input Generated column
title:string{50} t.string(..., limit='50')
price:decimal{10,2} t.decimal(..., precision='10', scale='2')
title:string (no braces) t.string(..., limit='255') (unchanged default)
status:enum:draft,published still parses values — braces do not steal the colon list

The same {N} limit parsing applies to integer, text, binary, and varchar aliases when they map through the migration emitter.

Not in this PR: :uniq / :index suffixes, bang ! for null:false, key-value brace options.

Feature Completeness Checklist

  • DCO sign-off -- Every commit carries Signed-off-by:
  • Tests -- ParseGeneratorArgsSpec + ScaffoldSpec cover brace parse + migration emit, plus enum regression
  • Framework Docs -- Updated web/sites/guides/src/content/docs/v4-0-0/command-line-tools/wheels-commands/code-generation.mdx (property type table + quoted-shell example)
  • AI Reference Docs -- N/A (CLI generator syntax, not a framework convention)
  • CLAUDE.md -- N/A (no model/controller/view convention change)
  • Changelog fragment -- changelog.d/cli-column-size-modifiers.added.md
  • Test runner passes -- Targeted CLI specs: 53 pass, 0 fail, 0 error (ParseGeneratorArgsSpec 8 + ScaffoldSpec 45)

Test Plan

  • Unit: title:string{50}limit 50
  • Unit: price:decimal{10,2} → precision 10, scale 2
  • Unit: bare title:string still 255
  • Unit: status:enum:a,b still parses values
  • Targeted TestBox run of ParseGeneratorArgsSpec + ScaffoldSpec (53 pass)
  • Complexity gate: python3 tools/code-quality/cfml-complexity.py cli/lucli --gate 30 --baseline tools/code-quality/baseline-cli.json passes
Open in Web Open in Cursor 

cursoragent and others added 3 commits September 9, 2026 18:45
Generator property tokens accept string{N} and decimal{P,S} braces.
parseGeneratorArgs stores limit / precision / scale on the prop, and
generated migrations use those overrides instead of the hardcoded
string 255 / integer 11 / decimal 10,2 defaults.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Peter Amiri <peter@alurium.com>
Pin title:string{50} → limit 50, price:decimal{10,2} → precision/scale,
bare title:string still 255, and status:enum:a,b values unchanged.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Peter Amiri <peter@alurium.com>
Add the brace syntax to the property type table, a quoted-shell
example, and a changelog fragment.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Peter Amiri <peter@alurium.com>
@github-actions github-actions Bot added the docs label Sep 9, 2026
@bpamiri
bpamiri marked this pull request as ready for review September 9, 2026 19:02
@bpamiri
bpamiri merged commit 155c153 into develop Sep 9, 2026
23 checks passed
@bpamiri
bpamiri deleted the cursor/cli-column-size-modifiers-13b9 branch September 9, 2026 19:02
bpamiri added a commit that referenced this pull request Sep 9, 2026
Follow-up to #3560. String-like \`{n}\` modifiers now also emit \`validatesLengthOf(property=..., maximum=n)\` on the generated model. Bare types and integer/decimal braces are unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants