Add --include-deps flag to --status for recursive dependency checking#2676
Add --include-deps flag to --status for recursive dependency checking#2676solvingj wants to merge 2 commits intogo-task:mainfrom
Conversation
- Add new --include-deps flag that works with --status - Recursively check all task dependencies when flag is enabled - Return exit code 1 if any dependency is not up-to-date - Extract checkTaskStatus helper for reusable status checking - Leverage existing traverse function for dependency traversal - Add deduplication to avoid checking shared dependencies multiple times - Add comprehensive test suite with 7 test scenarios - Add testdata with tasks having various dependency configurations - Flag validation ensures --include-deps requires --status Co-authored-by: Cursor <cursoragent@cursor.com>
Resolved conflicts in: - executor.go: Added IncludeDeps field alongside new Interactive field - internal/flags/flags.go: Added IncludeDeps flag alongside new Nested flag Co-authored-by: Cursor <cursoragent@cursor.com>
|
@solvingj In my mind, So with this PR, you are suggesting that If you wanted to know the status of a dependency (i.e. build) then simply: |
@timrulebosch this would be a breaking behavior and render this PR unacceptable. There are lots of other ways to approach the option, but I partially expect this PR to be declined in favor of an alternative approach as mentioned in that discussion, whereby tasks can add an additional flag to their dependency declarations, indicating that "if this deps runs, i need to run". For cases where deps don't generate any file which can be added to "source" of dependents. |
Relates to: #669
Summary
This PR adds a new
--include-depsflag that extends the--statusfunctionality to recursively check task dependencies. When enabled, it will return exit code 1 if any task in the dependency tree is not up-to-date.Motivation
Currently,
task --status my-taskonly checks ifmy-taskitself is up-to-date, ignoring whether its dependencies are up-to-date. This makes it difficult to determine if a task and all its dependencies are ready to run without actually executing them.Changes
--include-depsflag that works with--statuscheckTaskStatushelper for reusable status checkingtraversefunction for dependency traversal--include-depsrequires--statusUsage
Example
Given this Taskfile:
Implementation Details
traverse()function fromwatch.gofor dependency walkingfingerprint.IsTaskUpToDate()logic that checks bothstatus:commands andsources:/generates:fieldsTesting
TestStatusWithDeps()with 7 comprehensive test scenarios