Conversation
- Add SignalHandler class with register/remove/enable/disable API - Add enableSignalHandling() and setSignalHandler() to Runner - Add onSignal() per-command cleanup registration to Command - Default SIGINT: exits with code 130 (interactive: interrupts command only) - Default SIGTERM: sets shutdown flag, exits with code 143 - Graceful degradation on Windows (no-op when pcntl unavailable) - Interactive mode loop respects shutdown flag for clean exit - Per-command handlers auto-removed after command finishes Closes #45
feat(runner): add signal handling support (SIGINT/SIGTERM)
- Add shouldUseAnsi() static method with TTY detection via posix_isatty - Add --no-color global argument (respects no-color.org convention) - Add isAnsi() public method to Runner - Resolution precedence: --no-color > NO_COLOR env > --ansi > TTY detect - Command println/prints now use Runner's resolved ANSI value - Graceful Windows fallback via ANSICON/ConEmuANSI/TERM env checks - ANSI only auto-enables when output stream is StdOut (not in tests) Closes #50
Add hidden: false to all changelog-sections so commits like fix(ci), test:, docs:, refactor:, etc. appear in the changelog.
feat(runner): ANSI colors on by default with TTY auto-detection
- Add Verbosity class with QUIET, NORMAL, VERBOSE, DEBUG constants - Add -q, -v, -vv global arguments to Runner - Add getVerbosity() and setVerbosity() to Runner - Add verbose() and debug() methods to Command - Gate info() and success() by verbosity (suppressed in quiet mode) - error() and warning() always shown regardless of verbosity - println() and prints() unchanged (unconditional primitives) - Verbosity flags stripped from args passed to commands Closes #46
feat(command): add verbosity levels (-q, -v, -vv)
- Add WebFiori\Cli\Attributes\Group attribute for help display grouping - Add WebFiori\Cli\Attributes\SingleInstance attribute for lock-based single-instance enforcement - Add LockManager class using flock() for non-blocking exclusive locks - Add getGroup()/setGroup() to Command - Add resolveGroup() with precedence: explicit > attribute > colon convention - Integrate SingleInstance into excCommand() with try/finally lock release - Update HelpCommand to display commands in groups when present - Establish WebFiori\Cli\Attributes\ namespace per ADR-0025 Closes #47 Closes #49
feat(command): add #[Group] and #[SingleInstance] attributes
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #56 +/- ##
============================================
+ Coverage 87.72% 88.36% +0.63%
- Complexity 1322 1422 +100
============================================
Files 33 37 +4
Lines 3610 3858 +248
============================================
+ Hits 3167 3409 +242
- Misses 443 449 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Release merge containing multiple feature additions to the CLI library.
Motivation
Address enterprise readiness: signal handling for graceful shutdown, modern CLI conventions for color output, verbosity control for automation, and PHP attributes for command metadata.
Changes
Signal Handling (#45)
SignalHandlerclass with register/remove/enable/disable APIRunner::enableSignalHandling()with default SIGINT/SIGTERM handlersonSignal()cleanup registrationANSI Auto-Detection (#50)
Runner::shouldUseAnsi()with TTY detection viaposix_isatty--no-colorflag andNO_COLORenv support (no-color.org)--no-color>NO_COLORenv >--ansi> TTY detectVerbosity Levels (#46)
Verbosityconstants: QUIET, NORMAL, VERBOSE, DEBUG-q,-v,-vvglobal flagsverbose()anddebug()methods on Commandinfo()/success()suppressed in quiet modeCommand Attributes (#47, #49)
#[Group("name")]attribute for help display organization#[SingleInstance]attribute withLockManager(flock-based)resolveGroup()precedence: explicit > attribute > colon conventionHelpCommandexec(), released infinallyOther
release-please-config.json: show all commit types in changelogHow to Test / Verify
707 tests, 2083 assertions. 100% coverage on all new classes.
composer testBreaking Changes and Migration Steps
--no-colororNO_COLOR=1to disable)Checklist
Related issues
Closes #45
Closes #46
Closes #47
Closes #49
Closes #50