Skip to content

Apply Seed4J presets from the CLI #299

Description

@renanfranca

Parent issue

This issue is part of:

Support safe multi-module application from the Seed4J CLI

Dependencies

This issue should reuse the infrastructure introduced by:

  • Add a read-only plan for applying multiple modules
  • Apply multiple modules after successful preflight validation

Goal

Allow users to discover and apply the presets provided by Seed4J through the CLI.

Preset definitions must remain owned by the Seed4J core. The CLI must not maintain a duplicated hardcoded list of preset modules.

Proposed commands

List available presets:

seed4j preset list

Preview a preset:

seed4j preset apply java-library-with-maven \
  --project-path . \
  --plan

Apply a preset:

seed4j preset apply java-library-with-maven \
  --project-path .

Required module properties should be accepted using the same options and resolution rules as multi-module application.

Example:

seed4j preset apply java-library-with-maven \
  --project-path . \
  --project-name "Sample library" \
  --base-name sampleLibrary \
  --node-package-manager npm \
  --package-name com.mycompany.sample \
  --plan

Source of truth

The CLI must retrieve presets from the Seed4J application or domain APIs.

It must not:

  • duplicate preset names;
  • duplicate preset descriptions;
  • duplicate the module list belonging to a preset;
  • assume that the current preset collection will remain unchanged.

Changes to Seed4J presets should become available to the CLI without requiring a corresponding hardcoded CLI change.

Plan behavior

Preset plan mode must reuse the multi-module planner.

The output should show:

  • preset name;
  • preset description, when available;
  • modules included in the preset;
  • deterministic execution order;
  • dependency validation;
  • resolved properties;
  • missing required properties;
  • confirmation that no changes were applied.

Example structure:

Plan for preset: java-library-with-maven

Modules:
  - init
  - maven-java
  - maven-wrapper
  - java-library

Execution order:
  ...

Dependency validation:
  ...

Resolved parameters:
  ...

No changes were applied.

Apply behavior

Applying a preset must:

  1. resolve the preset from the Seed4J source of truth;
  2. convert its modules into the same model used by multi-module application;
  3. run the complete preflight validation;
  4. block execution when the plan is invalid;
  5. apply the validated modules in deterministic order;
  6. follow the same commit and partial-failure semantics as apply-set;
  7. report progress and results per module.

Error behavior

An unknown preset must produce:

  • a clear error message;
  • a non-zero exit code;
  • no project mutation;
  • a list of available presets or guidance to run seed4j preset list.

Acceptance criteria

  • seed4j preset list displays the presets currently provided by Seed4J.
  • Preset definitions are not duplicated in the CLI.
  • An unknown preset returns a clear error and non-zero exit code.
  • An unknown preset does not modify the project.
  • Preset plan mode reuses the multi-module planning behavior.
  • Preset plan mode is read-only.
  • The plan displays the modules included in the preset.
  • The plan displays the deterministic execution order.
  • The plan validates dependencies.
  • The plan resolves the combined property set.
  • Applying a preset reuses the multi-module execution behavior.
  • Applying a preset follows the defined commit and partial-failure semantics.
  • Feature providers are not selected implicitly outside the preset definition.
  • Existing single-module behavior remains unchanged.
  • CLI integration tests cover listing presets.
  • CLI integration tests cover planning a preset.
  • CLI integration tests cover successfully applying a preset.
  • CLI integration tests cover an unknown preset.
  • Documentation includes preset discovery, planning, and application examples.

Out of scope

  • Creating custom presets from the CLI.
  • Saving a module set as a new preset.
  • Editing Seed4J preset definitions.
  • Loading presets from local files.
  • Loading presets from external URLs.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions