Skip to content

Refactor missing steps collection into TodoReporter #162

Description

@DenTray

Description

What needs to be done?

Refactor the current logic for collecting skipped or missing setup steps and move it into a dedicated class that can gather this information and provide it to the console command to able it to render such info in user-friendly format.


Required changes:

    • Add a new enum for missing step categories: e.g. src/Enums/TodoCategoryEnum.php
    • Example categories:

      • Readme
      • Environment
      • Configuration
      • and other relevant categories
    • Add a new reporter class: src/Support/TodoReporter.php

The reporter must:

  1. Store a collection of TodoItem
  2. Provide convenient add methods for each category, e.g.:

    • addReadmeResourceLink(string $name, string $hint)
    • addReadmeField(string $name, string $hint)
    • addEnvVar(string $name, string $hint, string $file = '.env')
    • addConfiguration(string $integration, string $label, ?string $hint = null, array $meta = [])
  3. Provide method to return all collected items grouped by category


Update InitCommand.php:

  • stop adding plain strings into emptyResourcesList
  • use TodoReporter to collect missing steps
  • render the final result through TodoReporter at the end of the command execution


Method examples:

public function addReadmeField(
string $name,
?string $label = null,
?string $hint = null,
array $meta = []
): void {
$this->addItem(
category: TodoCategoryEnum::Readme,
label: $label ?? "Fill {$name}",
hint: $hint ?? 'in README',
meta: array_merge(['type' => 'field'], $meta),
);
}

public function addReadmeResourceLink(
string $name,
?string $label = null,
?string $hint = null,
array $meta = []
): void {
$this->addItem(
category: TodoCategoryEnum::Readme,
label: $label ?? "Fill {$name} link",
hint: $hint ?? 'in README',
meta: array_merge(['type' => 'link'], $meta),
);
}


Additional implementation notes:

  • Console output should be produced in a structured way and remain easy to read for the user.
  • The command description should stay clear and concise if any command text is updated.

Expected Outcome

What is the expected result?

  • Missing setup steps are collected through a dedicated TodoReporter instead of raw string arrays.
  • Todo items are grouped by category using TodoCategoryEnum.
  • InitCommand uses TodoReporter to collect and receive all missing steps for rendering.
  • Console output is clearer and more user-friendly.
  • The new structure is easier to extend with new todo categories and item types.

Verification Scenarios

How can this be tested?

  1. Run InitCommand in a scenario where README fields, links, environment variables, and configuration steps are missing.
  2. Verify these items are added through TodoReporter instead of emptyResourcesList.
  3. Confirm the final console output is grouped and readable.
  4. Verify TodoCategoryEnum is used for categorizing all todo items.
  5. Check that addReadmeField, addReadmeResourceLink, addEnvVar, and addConfiguration create correct items with expected labels, hints, and metadata.
  6. Ensure no debug information or errors appear in the console during command execution.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions