Skip to content

feat(cli): add #[Group] and #[SingleInstance] attributes to all framework commands - #416

Merged
usernane merged 5 commits into
mainfrom
dev
Sep 21, 2026
Merged

usernane merged 5 commits into
mainfrom
dev

Conversation

@usernane

Copy link
Copy Markdown
Member

Summary

Organizes all 33 framework built-in CLI commands into logical groups using the #[Group] attribute from webfiori/cli 2.2. Marks 9 destructive/concurrent-unsafe commands with #[SingleInstance].

Changes

Groups added (setup, create, migrations, queue, scheduler, routes, services, app):
All 33 command classes now carry #[Group('name')] for clean help output.

#[SingleInstance] added to:
migrations:run, fresh, rollback, step, queue:work, queue:retry, scheduler, scheduler:daemon, scheduler:run — commands where concurrent execution causes corruption or undefined behavior.

Corrected: UpCommand and DownCommand moved from maintenance to app group.

HelpCommandTest updated to reflect new grouped output.

Before / After

Before: flat alphabetical list under auto-detected colon-prefix groups (add:, create:, etc.)
After: intentional groups (setup, app, etc.) with SingleInstance guards on dangerous commands.

Checklist

  • All 34 command files lint clean
  • cs-fixer clean
  • HelpCommandTest passes (3 tests, 14 assertions)
  • No FQCN — imports used

Ibrahim BinAlshikh added 2 commits September 21, 2026 23:37
…work commands

Organizes 33 built-in commands into groups for php webfiori help display:
- setup:      add:db-connection, add:smtp-connection, add:lang
- create:     create:command/entity/middleware/migration/repository/
              resource/seeder/service/table/task
- migrations: migrations:run/dry-run/fresh/ini/rollback/skip/status/step
- queue:      queue:work/status/retry
- scheduler:  scheduler/scheduler:run/scheduler:daemon
- routes:     routes:cache/routes:clear
- services:   services:list
- app:        up/down/v

#[SingleInstance] on commands where concurrent execution causes corruption:
migrations:run/fresh/rollback/step, queue:work/retry, scheduler/daemon/run.

Also corrects UpCommand and DownCommand from Group('maintenance') to Group('app').
Groups changed: add: -> setup:, maintenance: -> app: (also moved v: from
other: to app:), scheduler: command order corrected. All 3 tests pass.
@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.04464% with 67 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.42%. Comparing base (eb2c7b8) to head (beac28e).

Files with missing lines Patch % Lines
...ori/Framework/Cli/Commands/CreateSeederCommand.php 52.17% 22 Missing ⚠️
...iori/Framework/Cli/Commands/QueueStatusCommand.php 21.42% 22 Missing ⚠️
...bFiori/Framework/Cli/Commands/QueueWorkCommand.php 0.00% 6 Missing ⚠️
.../Framework/Cli/Commands/FreshMigrationsCommand.php 54.54% 5 Missing ⚠️
...Framework/Cli/Commands/DryRunMigrationsCommand.php 82.35% 3 Missing ⚠️
...i/Framework/Cli/Commands/InitMigrationsCommand.php 0.00% 3 Missing ⚠️
...amework/Cli/Commands/RollbackMigrationsCommand.php 40.00% 3 Missing ⚠️
...Framework/Cli/Commands/MigrationsStatusCommand.php 50.00% 2 Missing ⚠️
WebFiori/Framework/App.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #416      +/-   ##
============================================
- Coverage     82.67%   82.42%   -0.26%     
- Complexity     3258     3265       +7     
============================================
  Files           106      106              
  Lines          9623     9654      +31     
============================================
+ Hits           7956     7957       +1     
- Misses         1667     1697      +30     
Flag Coverage Δ
php-8.1 81.40% <90.12%> (-0.02%) ⬇️
php-8.2 81.47% <90.12%> (-0.02%) ⬇️
php-8.3 89.93% <85.23%> (?)
php-8.4 89.93% <85.23%> (-0.34%) ⬇️
php-8.5 89.82% <85.23%> (-0.34%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Ibrahim BinAlshikh added 3 commits September 22, 2026 00:02
… handler

In queue:work, registers an error callback via QueueFacade::setOnError() that
forwards every caught job Throwable (terminal and retry) to the framework's
globally registered error handler (webfiori/err Handler). Background job
failures are now visible in the same centralized error channel as HTTP/CLI
errors.
After initializing the file logger in App::__construct(), registers
Handler::setDefaultLogCallback([LoggerFacade::class, 'log']) so that all
webfiori/err diagnostics (loop protection, handler failures, secureLog()
calls from custom handlers) are written to the same log channel as the
rest of the application.

The callback signature fn(string $level, string $message, array $context)
matches LoggerFacade::log() exactly — no adapter needed.
Enhances queue:status to display a detailed table of pending jobs (ID,
priority, attempts, available-at) when the storage backend implements
ListableQueueStorage. Falls back gracefully to count-only output with a
note when the backend does not support listing (catches LogicException).
@usernane
usernane merged commit 9d55048 into main Sep 21, 2026
13 of 14 checks passed
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