NAME

Mojolicious::Plugin::Fondation::Setup::Controller::Setup - Session-based setup wizard — no Workflow, no file persister

VERSION

version 0.11

SYNOPSIS

# Routes registered by Fondation::Setup:
GET  /setup          → wizard()   — main wizard page
GET  /setup/plugins  → plugins()  — plugin selection with checkboxes
GET  /setup/discover → discover() — JSON API: plugin list
POST /setup/start    → start()    — build session state, redirect
POST /setup/execute  → execute()  — process next/back/save
GET  /setup/reset    → reset()    — clear session, restart

DESCRIPTION

This controller implements the Setup wizard using Mojolicious sessions instead of Workflow.pm. State (selected plugins, current step, form values) is stored entirely in $self->session.

NAME

Mojolicious::Plugin::Fondation::Setup::Controller::Setup — Session-based setup wizard controller

SESSION KEYS

setup_plugins

Arrayref of selected plugin class names.

setup_states

Arrayref of wizard states. Each state is a hashref with label, plugin, description, and fields (arrayref of form field definitions).

setup_index

Integer index into setup_states. A value equal to the array size means "review", and beyond means "done".

setup_context

Hashref of accumulated form values ($key => $value).

setup_not_installed

Arrayref of plugin class names that are not yet installed via cpanm.

setup_retry

Arrayref of previously selected plugins, used by plugins() to pre-check them when the user clicks "I have installed the plugins, retry".

INTERNAL METHODS

_discover($cb)

Shared async discovery: fetches plugins from MetaCPAN, merges with dev_plugins_dir, and calls $cb with the merged arrayref.

_badges_for($plugin)

Returns an arrayref of {text, class, title?} hashes for rendering Bootstrap badges in the plugin selection template.

_install_command($upgradable, $missing, $cpan_ver)

Builds the cpanm command string for the install/upgrade alert. Returns undef if nothing to install.

_review_entries($context)

Returns sorted, filtered {key, value} pairs from the context hash (excludes internal _-prefixed keys and empty values).

_dev_plugins

Scans dev_plugins_dir for locally-developed Fondation plugins. Returns an arrayref with the same shape as MetaCPAN::discover_p.

_dev_plugins_dir

Returns the dev_plugins_dir path from $app->manager->config.

_generate_conf

Generates the $moniker.conf file from session state using Data::Dumper.

SEE ALSO

Mojolicious::Plugin::Fondation::Setup, Mojolicious::Plugin::Fondation::Setup::MetaCPAN

AUTHOR

Daniel Brosseau <dab@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Daniel Brosseau.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.