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:
ReadmeEnvironmentConfiguration- and other relevant categories
- Add a new reporter class:
src/Support/TodoReporter.php
The reporter must:
- Store a collection of
TodoItem 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 = [])
- 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?
- Run
InitCommand in a scenario where README fields, links, environment variables, and configuration steps are missing. - Verify these items are added through
TodoReporter instead of emptyResourcesList. - Confirm the final console output is grouped and readable.
- Verify
TodoCategoryEnum is used for categorizing all todo items. - Check that
addReadmeField, addReadmeResourceLink, addEnvVar, and addConfiguration create correct items with expected labels, hints, and metadata. - Ensure no debug information or errors appear in the console during command execution.
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:
src/Enums/TodoCategoryEnum.phpExample categories:
ReadmeEnvironmentConfigurationsrc/Support/TodoReporter.phpThe reporter must:
TodoItemProvide 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 = [])Update
InitCommand.php:emptyResourcesListTodoReporterto collect missing stepsTodoReporterat the end of the command executionMethod examples:
Additional implementation notes:
Expected Outcome
What is the expected result?
TodoReporterinstead of raw string arrays.TodoCategoryEnum.InitCommandusesTodoReporterto collect and receive all missing steps for rendering.Verification Scenarios
How can this be tested?
InitCommandin a scenario where README fields, links, environment variables, and configuration steps are missing.TodoReporterinstead ofemptyResourcesList.TodoCategoryEnumis used for categorizing all todo items.addReadmeField,addReadmeResourceLink,addEnvVar, andaddConfigurationcreate correct items with expected labels, hints, and metadata.