Skip to content

Conversation

@vertti
Copy link
Owner

@vertti vertti commented Dec 6, 2025

Summary

  • Add --timeout flag for version command timeout (default 30s)
  • Add --version-regex flag to extract versions from messy command output using regex capture groups
  • Add --range flag for semver constraint validation (e.g., >=1.0, <2.0, ^1.5, ~1.5)

Based on patterns from flaghunt.md research analyzing Goss, InSpec, Testinfra, and other infrastructure testing tools.

New Flags

Flag Description
--timeout <duration> Timeout for version command (default: 30s)
--version-regex <pattern> Regex with capture group to extract version
--range <constraint> Semver constraint (e.g., >=1.0, <2.0, ^1.5)

Examples

# Timeout for slow commands
preflight cmd slow-binary --timeout 60s

# Extract version from messy output
preflight cmd myapp --version-regex "version[:\s]+(\d+\.\d+\.\d+)" --min 2.0

# Semver range constraints
preflight cmd terraform --range ">=1.0, <2.0"
preflight cmd node --range "^18.0.0"

Adds timeout support to prevent hung version commands from blocking
builds. Default timeout is 30 seconds. The CmdRunner interface now
uses context for proper cancellation support.
@codecov
Copy link

codecov bot commented Dec 6, 2025

Codecov Report

❌ Patch coverage is 88.88889% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.63%. Comparing base (e7c083d) to head (dc7dc40).
⚠️ Report is 52 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cmdcheck/check.go 88.37% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #43      +/-   ##
==========================================
- Coverage   89.71%   89.63%   -0.09%     
==========================================
  Files          30       30              
  Lines        1021     1061      +40     
==========================================
+ Hits          916      951      +35     
- Misses         73       76       +3     
- Partials       32       34       +2     
Files with missing lines Coverage Δ
pkg/cmdcheck/runner.go 100.00% <100.00%> (ø)
pkg/cmdcheck/check.go 95.14% <88.37%> (-4.86%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Allows using a regex with capture group to extract version from messy
command output (e.g., "myapp version: 2.5.3 (built 2024)"). The
extracted version is then parsed and compared with --min/--max/--exact.
Adds support for semver constraints using the Masterminds/semver library.
Supports patterns like ">=1.0, <2.0", "^1.5.0" (caret), "~1.5.0" (tilde),
and other standard semver constraint syntax.
@vertti vertti force-pushed the cmd-version-enhancements branch from b92c020 to 53301f7 Compare December 6, 2025 11:05
@vertti vertti merged commit 3700bcf into main Dec 6, 2025
16 checks passed
@vertti vertti deleted the cmd-version-enhancements branch December 6, 2025 11:20
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.

2 participants