Skip to content

feat: unified rebar3 nova gen dispatcher with template system#13

Closed
Taure wants to merge 32 commits into
masterfrom
feat/unified-gen
Closed

feat: unified rebar3 nova gen dispatcher with template system#13
Taure wants to merge 32 commits into
masterfrom
feat/unified-gen

Conversation

@Taure

@Taure Taure commented Mar 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add unified rebar3 nova gen <type> <name> [opts] entry point that dispatches to gen modules
  • Extract shared helpers to rebar3_nova_utils (singularize, pluralize, capitalize, timestamp, parse_fields, render_template)
  • Convert gen_controller, gen_test, gen_auth to bbmustache templates under priv/templates/gen/
  • Replace thoas:encode/decode with json:encode/decode in gen_auth
  • Name is now a positional arg: rebar3 nova gen controller users
  • Old gen_* commands still work but emit deprecation warnings
  • Add integration test suite that scaffolds a project, runs all generators, validates syntax of all generated .erl files, and compiles the project end-to-end

Test plan

  • rebar3 fmt --check passes
  • rebar3 xref passes
  • rebar3 ct — all 40 tests pass (4 suites)
  • Integration suite generates a full project with all generators and rebar3 compile succeeds
  • Manual: rebar3 nova gen controller users generates correct controller
  • Manual: rebar3 nova gen auth generates 9 files with json:encode (no thoas)
  • Manual: old rebar3 nova gen_controller --name users still works with deprecation warning

Taure and others added 30 commits February 10, 2026 22:09
Add 9 new provider modules and a shared utility module:

Generators:
- gen_controller: scaffold controller with CRUD stub functions
- gen_router: scaffold router module with nova_router behaviour
- gen_resource: scaffold controller + JSON schema + route hints
- gen_test: scaffold Common Test suite for controller actions

Introspection & security:
- openapi: generate OpenAPI 3.0.3 spec from compiled routes
- middleware: display per-route-group plugin/middleware chains
- config: show Nova configuration with defaults
- audit: check routes for security issues (unsecured mutations, wildcards)

Release:
- release: regenerate OpenAPI spec if schemas exist, then build release

All providers registered in rebar3_nova:init/1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Document all nova subcommands with usage examples, options,
and expected output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Runs compile, dialyzer, and xref on OTP 28.0 / rebar3 3.26.0
for push and pull_request events.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Include rebar in base_plt_apps so dialyzer can resolve rebar3 API
types and functions used by the plugin (rebar_state, providers, etc).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rebar3 isn't a standard OTP app, so it can't be added to the PLT.
Remove unknown warning class since rebar3 plugin APIs can't be resolved.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rebar3 plugin APIs can't be added to dialyzer PLT. Remove dialyzer
from CI (keep compile + xref). Add no_unknown to local dialyzer config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Rebar3 plugin APIs aren't available during standalone xref.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Function was removed in latest nova — needs code fix separately.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Configure rebar3_ex_doc for hexdocs generation. Add ex_doc step
to CI workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat: add ex_doc config and docs CI step
Add generator, introspection, and release commands
The rebar3 new nova template always creates a router, so a separate
generator is unnecessary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Scaffolds a complete email/password authentication system into a Nova
app: migration, schemas, accounts context, security callback,
controllers, and CT test suite.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both openapi.json and swagger.html now default to priv/assets/ relative
to the app directory, making them easy to serve from a Nova static route.
The swagger UI spec URL is now relative so it works from any serving path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The branch protection requires a check named "build" but the custom
name field caused it to report as "OTP 28.0 / rebar3 3.26.0".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feat: remove gen_router, add gen_auth command
…sponses

Routes with `extra_state => #{json_schema => "./schemas/post.json"}` now
generate $ref links in the OpenAPI spec — requestBody for POST/PUT/PATCH
and response content schemas for all methods with a schema.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The primary_key/0 callback was removed from kura_schema (kura#26).
Generated schemas now use only #kura_field{primary_key = true}.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-callback

fix: remove primary_key/0 from gen_auth schema templates
* feat: add nova_fullstack project template

Full-stack Nova project template with Arizona LiveView and Kura database.
Scaffolds a complete project with liveview routing, PostgreSQL via Docker
Compose, migrations, and a reactive counter demo.

Usage: rebar3 new nova_fullstack name=myapp

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: correct arizona dep URL and add pubsub_scope config

- Change arizona dep from Taure/arizona_core to arizona-framework/arizona
  (full framework needed for arizona_websocket)
- Add pubsub_scope => nova_scope to arizona config in dev and prod

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: share template files between nova and nova_fullstack

Deduplicate app.erl, sup.erl, vm.args.src, and .tool-versions by having
nova_fullstack reference the shared files from nova/. Standardize on
the cleaner formatting style.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: use arizona_nova instead of full arizona framework

Update fullstack template to depend on arizona_nova (Nova-specific
integration layer) instead of the full arizona framework. Updates
sys.config, app.src, Makefile, and rebar.config deps accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: migrate CI to Taure/erlang-ci reusable workflow

* style: format codebase with erlfmt

* fix: resolve dialyzer warnings in serve, audit, and openapi modules

* chore: add .git-blame-ignore-revs for fmt commit

* ci: disable dialyzer until upstream deps are fixed

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Replace the dated 2014-era CSS stars landing page with a clean,
modern card-based design. Fixes broken animations, removes 25KB of
hardcoded box-shadow coordinates, adds light/dark mode support,
responsive layout, and zero external dependencies.
Single command replaces multiple templates with composable flags:
rebar3 nova new myapp [--kura] [--pgo] [--arizona] [--lfe] [--ci] [--docker] [--otel]

- --kura/--pgo mutually exclusive, all others freely combinable
- Each flag conditionally adds deps, plugins, config, and source files
- Adds write_file/2 and copy_priv_file/2 to rebar3_nova_utils
- 11 CT tests covering all flags and combinations
Generates Arizona LiveView CRUD views, Kura schema, migration, and
test suite for a resource. Similar to Phoenix's phx.gen.live.

Usage:
  rebar3 nova gen_live --name users --fields name:string,email:string

Generated files:
- src/views/{app}_{resource}_{action}_view.erl (index/show/new/edit)
- src/schemas/{app}_{resource}.erl (Kura schema)
- src/migrations/m{ts}_create_{table}.erl (Kura migration)
- test/{app}_{resource}_live_SUITE.erl (CT test suite)

Also fixes the home_view scaffold in `nova new --arizona` to use
the current Arizona API (arizona_view:new/3, arizona_template:from_html,
arizona_parse_transform).
Resolve merge conflicts in rebar.config and release.yml.
Taure added 2 commits March 19, 2026 14:44
Restructure gen_* commands into a single `rebar3 nova gen <type> <name>`
entry point with bbmustache templates for code generation.

- Add rebar3_nova_gen.erl dispatcher routing to gen modules by type
- Extract shared helpers to rebar3_nova_utils (singularize, pluralize,
  capitalize, timestamp, parse_fields, render_template)
- Add run/1 and run/2 to each gen module; do/1 emits deprecation warning
- Convert gen_controller, gen_test, gen_auth to mustache templates
- Replace thoas:encode/decode with json:encode/decode in gen_auth
- Name is now a positional arg: `rebar3 nova gen controller users`
- Old gen_* commands still work for backward compatibility
- Add rebar3_nova_gen_SUITE (12 tests) and integration suite (7 tests)
- Integration suite scaffolds a project, runs all generators, validates
  syntax of 24 .erl files, and runs rebar3 compile end-to-end
@Taure

Taure commented Mar 19, 2026

Copy link
Copy Markdown
Owner Author

Moved to novaframework#63

@Taure Taure closed this Mar 19, 2026
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.

1 participant