Skip to content

Conversation

@lex57ukr
Copy link
Contributor

Summary

Cocona exposes method parameters as CLI options by default, which caused CancellationToken parameters to appear as --cancellation-token in help output. This PR removes those parameters from command method signatures and instead injects ICoconaAppContextAccessor to access the cancellation token from the Cocona app context. This keeps CLI help clean and user-focused while preserving proper cancellation support.

Related Issues

Fixes #21

Changes

  • Refactor SwitchTemplateSubCommand and NewCommandController to inject ICoconaAppContextAccessor and retrieve CancellationToken from context instead of method parameters
  • Add CoconaCommandMethodConventionsTests regression test that scans command methods via reflection and fails if any expose CancellationToken parameters
  • Add CoconaAppContextFactory test utility for creating CoconaAppContext instances in tests
  • Update CLAUDE.md with Cocona conventions for handling CancellationToken and document the new test utilities

@lex57ukr lex57ukr added bug Something isn't working enhancement New feature or request labels Jan 18, 2026
@lex57ukr lex57ukr linked an issue Jan 18, 2026 that may be closed by this pull request
@lex57ukr lex57ukr changed the title Hide CancellationToken parameters from CLI help output Hide CancellationToken parameters from CLI help output Jan 18, 2026
@lex57ukr lex57ukr merged commit 441eb63 into main Jan 18, 2026
1 check passed
@lex57ukr lex57ukr deleted the 21-hide-cancellationtoken-parameters-from-cli-help-output branch January 18, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide CancellationToken parameters from CLI help output

2 participants