tasktree 0.0.22__tar.gz → 0.0.23__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. {tasktree-0.0.22 → tasktree-0.0.23}/.github/workflows/test.yml +3 -3
  2. {tasktree-0.0.22 → tasktree-0.0.23}/.gitignore +2 -0
  3. {tasktree-0.0.22 → tasktree-0.0.23}/PKG-INFO +201 -4
  4. {tasktree-0.0.22 → tasktree-0.0.23}/README.md +200 -3
  5. {tasktree-0.0.22 → tasktree-0.0.23}/pyproject.toml +1 -1
  6. {tasktree-0.0.22 → tasktree-0.0.23}/schema/tasktree-schema.json +6 -0
  7. {tasktree-0.0.22 → tasktree-0.0.23}/src/tasktree/__init__.py +1 -1
  8. {tasktree-0.0.22 → tasktree-0.0.23}/src/tasktree/cli.py +145 -112
  9. tasktree-0.0.23/src/tasktree/console_logger.py +66 -0
  10. {tasktree-0.0.22 → tasktree-0.0.23}/src/tasktree/docker.py +14 -8
  11. {tasktree-0.0.22 → tasktree-0.0.23}/src/tasktree/executor.py +161 -41
  12. {tasktree-0.0.22 → tasktree-0.0.23}/src/tasktree/graph.py +3 -3
  13. {tasktree-0.0.22 → tasktree-0.0.23}/src/tasktree/hasher.py +5 -5
  14. tasktree-0.0.23/src/tasktree/logging.py +112 -0
  15. {tasktree-0.0.22 → tasktree-0.0.23}/src/tasktree/parser.py +20 -17
  16. tasktree-0.0.23/src/tasktree/process_runner.py +411 -0
  17. {tasktree-0.0.22 → tasktree-0.0.23}/src/tasktree/substitution.py +2 -2
  18. {tasktree-0.0.22 → tasktree-0.0.23}/src/tasktree/types.py +3 -3
  19. {tasktree-0.0.22 → tasktree-0.0.23}/tasktree.yaml +9 -8
  20. {tasktree-0.0.22 → tasktree-0.0.23}/tests/e2e/__init__.py +2 -1
  21. {tasktree-0.0.22 → tasktree-0.0.23}/tests/e2e/test_docker_basic.py +4 -4
  22. {tasktree-0.0.22 → tasktree-0.0.23}/tests/e2e/test_docker_environment.py +4 -4
  23. {tasktree-0.0.22 → tasktree-0.0.23}/tests/e2e/test_docker_ownership.py +3 -3
  24. {tasktree-0.0.22 → tasktree-0.0.23}/tests/e2e/test_docker_volumes.py +5 -5
  25. tasktree-0.0.23/tests/e2e/test_logging_full_workflow.py +299 -0
  26. {tasktree-0.0.22 → tasktree-0.0.23}/tests/e2e/test_non_docker.py +4 -4
  27. tasktree-0.0.23/tests/e2e/test_task_output.py +526 -0
  28. tasktree-0.0.23/tests/helpers/io.py +14 -0
  29. tasktree-0.0.23/tests/helpers/logging.py +28 -0
  30. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_arg_choices.py +1 -1
  31. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_arg_min_max.py +1 -1
  32. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_builtin_variables.py +50 -32
  33. tasktree-0.0.23/tests/integration/test_clean_state.py +107 -0
  34. tasktree-0.0.23/tests/integration/test_cli_log_level.py +237 -0
  35. tasktree-0.0.23/tests/integration/test_cli_logging.py +211 -0
  36. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_cli_options.py +1 -1
  37. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_dependency_execution.py +24 -12
  38. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_end_to_end.py +5 -5
  39. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_exported_args.py +46 -32
  40. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_input_detection.py +3 -3
  41. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_missing_outputs.py +16 -12
  42. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_nested_imports.py +3 -3
  43. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_parameterized_deps_execution.py +1 -1
  44. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_parameterized_deps_templates.py +8 -8
  45. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_private_tasks_execution.py +1 -1
  46. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_self_references.py +8 -8
  47. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_state_persistence.py +4 -4
  48. tasktree-0.0.23/tests/integration/test_task_output.py +298 -0
  49. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_unified_execution.py +5 -5
  50. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_working_directory.py +3 -3
  51. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_cli.py +169 -28
  52. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_docker.py +39 -20
  53. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_environment_tracking.py +61 -26
  54. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_executor.py +390 -191
  55. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_graph.py +2 -2
  56. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_list_formatting.py +77 -49
  57. tasktree-0.0.23/tests/unit/test_logging.py +255 -0
  58. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_parser.py +18 -17
  59. tasktree-0.0.23/tests/unit/test_process_runner.py +821 -0
  60. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_substitution.py +20 -20
  61. tasktree-0.0.22/.claude/settings.local.json +0 -23
  62. tasktree-0.0.22/tests/integration/test_clean_state.py +0 -187
  63. {tasktree-0.0.22 → tasktree-0.0.23}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  64. {tasktree-0.0.22 → tasktree-0.0.23}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  65. {tasktree-0.0.22 → tasktree-0.0.23}/.github/workflows/claude-code-review.yml +0 -0
  66. {tasktree-0.0.22 → tasktree-0.0.23}/.github/workflows/claude.yml +0 -0
  67. {tasktree-0.0.22 → tasktree-0.0.23}/.github/workflows/release.yml +0 -0
  68. {tasktree-0.0.22 → tasktree-0.0.23}/.github/workflows/validate-pipx-install.yml +0 -0
  69. {tasktree-0.0.22 → tasktree-0.0.23}/.python-version +0 -0
  70. {tasktree-0.0.22 → tasktree-0.0.23}/CLAUDE.md +0 -0
  71. {tasktree-0.0.22 → tasktree-0.0.23}/__init__.py +0 -0
  72. {tasktree-0.0.22 → tasktree-0.0.23}/example/source.txt +0 -0
  73. {tasktree-0.0.22 → tasktree-0.0.23}/example/tasktree.yaml +0 -0
  74. {tasktree-0.0.22 → tasktree-0.0.23}/schema/README.md +0 -0
  75. {tasktree-0.0.22 → tasktree-0.0.23}/schema/vscode-settings-snippet.json +0 -0
  76. {tasktree-0.0.22 → tasktree-0.0.23}/src/__init__.py +0 -0
  77. {tasktree-0.0.22 → tasktree-0.0.23}/src/tasktree/state.py +0 -0
  78. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_dependency_outputs.py +0 -0
  79. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_docker_build_args.py +0 -0
  80. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_parameterized_dependencies.yaml +0 -0
  81. {tasktree-0.0.22 → tasktree-0.0.23}/tests/integration/test_variables.py +0 -0
  82. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_dependency_parsing.py +0 -0
  83. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_hasher.py +0 -0
  84. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_parameterized_graph.py +0 -0
  85. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_private_tasks.py +0 -0
  86. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_state.py +0 -0
  87. {tasktree-0.0.22 → tasktree-0.0.23}/tests/unit/test_types.py +0 -0
  88. {tasktree-0.0.22 → tasktree-0.0.23}/uv.lock +0 -0
@@ -34,14 +34,14 @@ jobs:
34
34
  run: docker pull alpine:latest
35
35
 
36
36
  - name: Run unit tests
37
- run: uv run pytest tests/unit/ --tb=short
37
+ run: PYTHONPATH=tests uv run pytest tests/unit/ --tb=short
38
38
 
39
39
  - name: Run integration tests
40
- run: uv run pytest tests/integration/ --tb=short
40
+ run: PYTHONPATH=tests uv run pytest tests/integration/ --tb=short
41
41
 
42
42
  - name: Run E2E Docker tests
43
43
  if: runner.os == 'Linux'
44
- run: uv run pytest tests/e2e/ --tb=short
44
+ run: PYTHONPATH=tests uv run pytest tests/e2e/ --tb=short
45
45
 
46
46
  - name: Test CLI commands
47
47
  run: |
@@ -159,3 +159,5 @@ requirements/*
159
159
 
160
160
  .athena-cache
161
161
 
162
+ .claude/settings.local.json
163
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tasktree
3
- Version: 0.0.22
3
+ Version: 0.0.23
4
4
  Summary: A task automation tool with incremental execution
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: click>=8.1.0
@@ -251,6 +251,7 @@ tasks:
251
251
  working_dir: subproject/ # Execution directory (default: project root)
252
252
  env: bash-strict # Execution environment (optional)
253
253
  private: false # Hide from --list output (default: false)
254
+ task_output: all # Control task output: all, out, err, on-err, none (default: all)
254
255
  args: # Task parameters
255
256
  - param1 # Simple argument
256
257
  - param2: { type: path, default: "." } # With type and default
@@ -877,7 +878,8 @@ tasks:
877
878
  inputs: [src/app-{{ var.version }}.c]
878
879
  outputs: [build/app-{{ var.version }}.o]
879
880
  cmd: gcc src/app-{{ var.version }}.c -o build/app-{{ var.version }}.o
880
-
881
+ ```
882
+ ```yaml
881
883
  # With self-references - DRY
882
884
  tasks:
883
885
  build:
@@ -1619,6 +1621,14 @@ tt -o deploy
1619
1621
  # Override environment for all tasks
1620
1622
  tt --env python analyze
1621
1623
  tt -e powershell build
1624
+
1625
+ # Control task subprocess output display
1626
+ tt --task-output all build # Show both stdout and stderr (default)
1627
+ tt --task-output out test # Show only stdout
1628
+ tt --task-output err deploy # Show only stderr
1629
+ tt --task-output on-err ci # Show stderr only if task fails
1630
+ tt --task-output none build # Suppress all task output
1631
+ tt -O none build # Short form
1622
1632
  ```
1623
1633
 
1624
1634
  ### Information Commands
@@ -1647,8 +1657,6 @@ tt --init
1647
1657
  ```bash
1648
1658
  # Remove state file (reset task cache)
1649
1659
  tt --clean
1650
- tt --clean-state
1651
- tt --reset
1652
1660
  ```
1653
1661
 
1654
1662
  ### Common Workflows
@@ -1667,6 +1675,194 @@ tt --env python test
1667
1675
  tt --force deploy production
1668
1676
  ```
1669
1677
 
1678
+ ### Logging Control
1679
+
1680
+ Task Tree provides fine-grained control over diagnostic logging verbosity through the `--log-level` flag. This allows you to adjust the amount of information displayed about task execution, from minimal error-only output to detailed trace logging.
1681
+
1682
+ **Log Levels:**
1683
+
1684
+ ```bash
1685
+ # Show only fatal errors (malformed task files, missing dependencies)
1686
+ tt --log-level fatal build
1687
+
1688
+ # Show fatal errors and task execution failures
1689
+ tt --log-level error build
1690
+
1691
+ # Show errors and warnings (deprecated features, configuration issues)
1692
+ tt --log-level warn build
1693
+
1694
+ # Show normal execution progress (default)
1695
+ tt --log-level info build
1696
+ tt build # Same as above
1697
+
1698
+ # Show detailed diagnostics (variable values, resolved paths, environment details)
1699
+ tt --log-level debug build
1700
+
1701
+ # Show fine-grained execution tracing
1702
+ tt --log-level trace build
1703
+ ```
1704
+
1705
+ **Short Form:**
1706
+
1707
+ ```bash
1708
+ tt -L debug build
1709
+ tt -L trace test
1710
+ ```
1711
+
1712
+ **Case Insensitive:**
1713
+
1714
+ ```bash
1715
+ tt --log-level INFO build # Works
1716
+ tt --log-level Debug test # Works
1717
+ tt --log-level TRACE deploy # Works
1718
+ ```
1719
+
1720
+ **Common Use Cases:**
1721
+
1722
+ **Debugging Workflows:**
1723
+ ```bash
1724
+ # See variable substitution and resolved paths
1725
+ tt --log-level debug deploy production
1726
+
1727
+ # See detailed execution steps and internal state
1728
+ tt --log-level trace build
1729
+ ```
1730
+
1731
+ **CI/CD Environments:**
1732
+ ```bash
1733
+ # Suppress progress messages, show only errors
1734
+ tt --log-level error build test package
1735
+
1736
+ # Minimal output for clean build logs
1737
+ tt --log-level warn ci
1738
+ ```
1739
+
1740
+ **Normal Development:**
1741
+ ```bash
1742
+ # Default level shows normal execution progress
1743
+ tt build test
1744
+ ```
1745
+
1746
+ **Understanding Log Levels:**
1747
+
1748
+ - **FATAL** (least verbose): Only unrecoverable errors that prevent execution
1749
+ - **ERROR**: Fatal errors plus individual task failures
1750
+ - **WARN**: Errors plus warnings about deprecated features or configuration issues
1751
+ - **INFO** (default): Normal execution progress messages
1752
+ - **DEBUG**: Info plus variable values, resolved paths, environment configuration
1753
+ - **TRACE** (most verbose): Debug plus fine-grained execution tracing
1754
+
1755
+ Log levels are hierarchical - setting a higher verbosity level (e.g., DEBUG) includes all messages from lower levels (FATAL, ERROR, WARN, INFO).
1756
+
1757
+ **Note:** The `--log-level` flag controls Task Tree's own diagnostic messages. It does not affect the output of task commands themselves - use `--task-output` to control task subprocess output (see below).
1758
+
1759
+ ### Task Output Control
1760
+
1761
+ Task Tree provides fine-grained control over task subprocess output through the `--task-output` flag. This allows you to control whether tasks display their stdout, stderr, both, or neither, independent of Task Tree's own diagnostic logging.
1762
+
1763
+ **Output Modes:**
1764
+
1765
+ ```bash
1766
+ # Show both stdout and stderr (default)
1767
+ tt --task-output all build
1768
+ tt -O all build
1769
+ tt build # Same as above
1770
+
1771
+ # Show only stdout, suppress stderr
1772
+ tt --task-output out build
1773
+ tt -O out test
1774
+
1775
+ # Show only stderr, suppress stdout
1776
+ tt --task-output err build
1777
+ tt -O err deploy
1778
+
1779
+ # Show stderr only if the task fails (stdout always suppressed)
1780
+ tt --task-output on-err build
1781
+ tt -O on-err ci
1782
+
1783
+ # Suppress all task output
1784
+ tt --task-output none build
1785
+ tt -O none build
1786
+ ```
1787
+
1788
+ **Case Insensitive:**
1789
+
1790
+ ```bash
1791
+ tt --task-output ALL build # Works
1792
+ tt --task-output Out test # Works
1793
+ tt --task-output ON-ERR ci # Works
1794
+ ```
1795
+
1796
+ **Common Use Cases:**
1797
+
1798
+ **CI/CD Environments:**
1799
+ ```bash
1800
+ # Suppress task output, show only tasktree diagnostics
1801
+ tt --log-level info --task-output none build test
1802
+
1803
+ # Show errors only if they occur
1804
+ tt --log-level error --task-output on-err ci
1805
+ ```
1806
+
1807
+ **Debugging:**
1808
+ ```bash
1809
+ # Show only stderr to focus on warnings/errors
1810
+ tt --task-output err build
1811
+
1812
+ # Show everything for full visibility
1813
+ tt --log-level debug --task-output all build
1814
+ ```
1815
+
1816
+ **Clean Build Logs:**
1817
+ ```bash
1818
+ # Suppress noisy build output, show only tasktree progress
1819
+ tt --task-output none build package deploy
1820
+ ```
1821
+
1822
+ **Task-Level Configuration:**
1823
+
1824
+ Tasks can specify their own default output behavior in the recipe file:
1825
+
1826
+ ```yaml
1827
+ tasks:
1828
+ # Noisy task - suppress output by default
1829
+ install-deps:
1830
+ task_output: none
1831
+ cmd: npm install
1832
+
1833
+ # Let pytest manage its own output - it's already good at that
1834
+ test:
1835
+ cmd: pytest tests/
1836
+
1837
+ # Don't clutter CI logs with loads of output, unless something goes wrong
1838
+ build:
1839
+ task_output: on-err
1840
+ cmd: cargo build --release
1841
+ ```
1842
+
1843
+ **Understanding Output Modes:**
1844
+
1845
+ | Mode | Stdout | Stderr | Notes |
1846
+ |------|--------|--------|-------|
1847
+ | `all` | ✓ | ✓ | Default behavior, shows everything |
1848
+ | `out` | ✓ | ✗ | Good for capturing command results |
1849
+ | `err` | ✗ | ✓ | Focus on warnings and errors |
1850
+ | `on-err` | ✗ | ✓ (on failure) | Stderr buffered, shown only if task fails |
1851
+ | `none` | ✗ | ✗ | Silent execution, useful for noisy tasks |
1852
+
1853
+ **Override Behavior:**
1854
+
1855
+ - Command-line `--task-output` overrides task-level `task_output` settings for all tasks
1856
+ - Task-level `task_output` applies only if no command-line flag is provided
1857
+ - Default behavior is `all` if neither is specified
1858
+
1859
+ **Important Notes:**
1860
+
1861
+ - Task output control is independent of `--log-level` - you can suppress task output while still seeing tasktree diagnostics
1862
+ - The `on-err` mode buffers stderr in memory and only displays it if the task fails
1863
+ - Output suppression does not affect the task's execution - files are still created, commands still run
1864
+ - Task exit codes are always checked regardless of output mode
1865
+
1670
1866
  ## Example: Full Build Pipeline
1671
1867
 
1672
1868
  ```yaml
@@ -1678,6 +1874,7 @@ tasks:
1678
1874
  compile:
1679
1875
  desc: Build application binaries
1680
1876
  outputs: [target/release/app]
1877
+ task_output: "on-err" # We only care about seeing this if it fails.
1681
1878
  cmd: cargo build --release
1682
1879
 
1683
1880
  test-unit:
@@ -234,6 +234,7 @@ tasks:
234
234
  working_dir: subproject/ # Execution directory (default: project root)
235
235
  env: bash-strict # Execution environment (optional)
236
236
  private: false # Hide from --list output (default: false)
237
+ task_output: all # Control task output: all, out, err, on-err, none (default: all)
237
238
  args: # Task parameters
238
239
  - param1 # Simple argument
239
240
  - param2: { type: path, default: "." } # With type and default
@@ -860,7 +861,8 @@ tasks:
860
861
  inputs: [src/app-{{ var.version }}.c]
861
862
  outputs: [build/app-{{ var.version }}.o]
862
863
  cmd: gcc src/app-{{ var.version }}.c -o build/app-{{ var.version }}.o
863
-
864
+ ```
865
+ ```yaml
864
866
  # With self-references - DRY
865
867
  tasks:
866
868
  build:
@@ -1602,6 +1604,14 @@ tt -o deploy
1602
1604
  # Override environment for all tasks
1603
1605
  tt --env python analyze
1604
1606
  tt -e powershell build
1607
+
1608
+ # Control task subprocess output display
1609
+ tt --task-output all build # Show both stdout and stderr (default)
1610
+ tt --task-output out test # Show only stdout
1611
+ tt --task-output err deploy # Show only stderr
1612
+ tt --task-output on-err ci # Show stderr only if task fails
1613
+ tt --task-output none build # Suppress all task output
1614
+ tt -O none build # Short form
1605
1615
  ```
1606
1616
 
1607
1617
  ### Information Commands
@@ -1630,8 +1640,6 @@ tt --init
1630
1640
  ```bash
1631
1641
  # Remove state file (reset task cache)
1632
1642
  tt --clean
1633
- tt --clean-state
1634
- tt --reset
1635
1643
  ```
1636
1644
 
1637
1645
  ### Common Workflows
@@ -1650,6 +1658,194 @@ tt --env python test
1650
1658
  tt --force deploy production
1651
1659
  ```
1652
1660
 
1661
+ ### Logging Control
1662
+
1663
+ Task Tree provides fine-grained control over diagnostic logging verbosity through the `--log-level` flag. This allows you to adjust the amount of information displayed about task execution, from minimal error-only output to detailed trace logging.
1664
+
1665
+ **Log Levels:**
1666
+
1667
+ ```bash
1668
+ # Show only fatal errors (malformed task files, missing dependencies)
1669
+ tt --log-level fatal build
1670
+
1671
+ # Show fatal errors and task execution failures
1672
+ tt --log-level error build
1673
+
1674
+ # Show errors and warnings (deprecated features, configuration issues)
1675
+ tt --log-level warn build
1676
+
1677
+ # Show normal execution progress (default)
1678
+ tt --log-level info build
1679
+ tt build # Same as above
1680
+
1681
+ # Show detailed diagnostics (variable values, resolved paths, environment details)
1682
+ tt --log-level debug build
1683
+
1684
+ # Show fine-grained execution tracing
1685
+ tt --log-level trace build
1686
+ ```
1687
+
1688
+ **Short Form:**
1689
+
1690
+ ```bash
1691
+ tt -L debug build
1692
+ tt -L trace test
1693
+ ```
1694
+
1695
+ **Case Insensitive:**
1696
+
1697
+ ```bash
1698
+ tt --log-level INFO build # Works
1699
+ tt --log-level Debug test # Works
1700
+ tt --log-level TRACE deploy # Works
1701
+ ```
1702
+
1703
+ **Common Use Cases:**
1704
+
1705
+ **Debugging Workflows:**
1706
+ ```bash
1707
+ # See variable substitution and resolved paths
1708
+ tt --log-level debug deploy production
1709
+
1710
+ # See detailed execution steps and internal state
1711
+ tt --log-level trace build
1712
+ ```
1713
+
1714
+ **CI/CD Environments:**
1715
+ ```bash
1716
+ # Suppress progress messages, show only errors
1717
+ tt --log-level error build test package
1718
+
1719
+ # Minimal output for clean build logs
1720
+ tt --log-level warn ci
1721
+ ```
1722
+
1723
+ **Normal Development:**
1724
+ ```bash
1725
+ # Default level shows normal execution progress
1726
+ tt build test
1727
+ ```
1728
+
1729
+ **Understanding Log Levels:**
1730
+
1731
+ - **FATAL** (least verbose): Only unrecoverable errors that prevent execution
1732
+ - **ERROR**: Fatal errors plus individual task failures
1733
+ - **WARN**: Errors plus warnings about deprecated features or configuration issues
1734
+ - **INFO** (default): Normal execution progress messages
1735
+ - **DEBUG**: Info plus variable values, resolved paths, environment configuration
1736
+ - **TRACE** (most verbose): Debug plus fine-grained execution tracing
1737
+
1738
+ Log levels are hierarchical - setting a higher verbosity level (e.g., DEBUG) includes all messages from lower levels (FATAL, ERROR, WARN, INFO).
1739
+
1740
+ **Note:** The `--log-level` flag controls Task Tree's own diagnostic messages. It does not affect the output of task commands themselves - use `--task-output` to control task subprocess output (see below).
1741
+
1742
+ ### Task Output Control
1743
+
1744
+ Task Tree provides fine-grained control over task subprocess output through the `--task-output` flag. This allows you to control whether tasks display their stdout, stderr, both, or neither, independent of Task Tree's own diagnostic logging.
1745
+
1746
+ **Output Modes:**
1747
+
1748
+ ```bash
1749
+ # Show both stdout and stderr (default)
1750
+ tt --task-output all build
1751
+ tt -O all build
1752
+ tt build # Same as above
1753
+
1754
+ # Show only stdout, suppress stderr
1755
+ tt --task-output out build
1756
+ tt -O out test
1757
+
1758
+ # Show only stderr, suppress stdout
1759
+ tt --task-output err build
1760
+ tt -O err deploy
1761
+
1762
+ # Show stderr only if the task fails (stdout always suppressed)
1763
+ tt --task-output on-err build
1764
+ tt -O on-err ci
1765
+
1766
+ # Suppress all task output
1767
+ tt --task-output none build
1768
+ tt -O none build
1769
+ ```
1770
+
1771
+ **Case Insensitive:**
1772
+
1773
+ ```bash
1774
+ tt --task-output ALL build # Works
1775
+ tt --task-output Out test # Works
1776
+ tt --task-output ON-ERR ci # Works
1777
+ ```
1778
+
1779
+ **Common Use Cases:**
1780
+
1781
+ **CI/CD Environments:**
1782
+ ```bash
1783
+ # Suppress task output, show only tasktree diagnostics
1784
+ tt --log-level info --task-output none build test
1785
+
1786
+ # Show errors only if they occur
1787
+ tt --log-level error --task-output on-err ci
1788
+ ```
1789
+
1790
+ **Debugging:**
1791
+ ```bash
1792
+ # Show only stderr to focus on warnings/errors
1793
+ tt --task-output err build
1794
+
1795
+ # Show everything for full visibility
1796
+ tt --log-level debug --task-output all build
1797
+ ```
1798
+
1799
+ **Clean Build Logs:**
1800
+ ```bash
1801
+ # Suppress noisy build output, show only tasktree progress
1802
+ tt --task-output none build package deploy
1803
+ ```
1804
+
1805
+ **Task-Level Configuration:**
1806
+
1807
+ Tasks can specify their own default output behavior in the recipe file:
1808
+
1809
+ ```yaml
1810
+ tasks:
1811
+ # Noisy task - suppress output by default
1812
+ install-deps:
1813
+ task_output: none
1814
+ cmd: npm install
1815
+
1816
+ # Let pytest manage its own output - it's already good at that
1817
+ test:
1818
+ cmd: pytest tests/
1819
+
1820
+ # Don't clutter CI logs with loads of output, unless something goes wrong
1821
+ build:
1822
+ task_output: on-err
1823
+ cmd: cargo build --release
1824
+ ```
1825
+
1826
+ **Understanding Output Modes:**
1827
+
1828
+ | Mode | Stdout | Stderr | Notes |
1829
+ |------|--------|--------|-------|
1830
+ | `all` | ✓ | ✓ | Default behavior, shows everything |
1831
+ | `out` | ✓ | ✗ | Good for capturing command results |
1832
+ | `err` | ✗ | ✓ | Focus on warnings and errors |
1833
+ | `on-err` | ✗ | ✓ (on failure) | Stderr buffered, shown only if task fails |
1834
+ | `none` | ✗ | ✗ | Silent execution, useful for noisy tasks |
1835
+
1836
+ **Override Behavior:**
1837
+
1838
+ - Command-line `--task-output` overrides task-level `task_output` settings for all tasks
1839
+ - Task-level `task_output` applies only if no command-line flag is provided
1840
+ - Default behavior is `all` if neither is specified
1841
+
1842
+ **Important Notes:**
1843
+
1844
+ - Task output control is independent of `--log-level` - you can suppress task output while still seeing tasktree diagnostics
1845
+ - The `on-err` mode buffers stderr in memory and only displays it if the task fails
1846
+ - Output suppression does not affect the task's execution - files are still created, commands still run
1847
+ - Task exit codes are always checked regardless of output mode
1848
+
1653
1849
  ## Example: Full Build Pipeline
1654
1850
 
1655
1851
  ```yaml
@@ -1661,6 +1857,7 @@ tasks:
1661
1857
  compile:
1662
1858
  desc: Build application binaries
1663
1859
  outputs: [target/release/app]
1860
+ task_output: "on-err" # We only care about seeing this if it fails.
1664
1861
  cmd: cargo build --release
1665
1862
 
1666
1863
  test-unit:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tasktree"
3
- version = "0.0.22"
3
+ version = "0.0.23"
4
4
  description = "A task automation tool with incremental execution"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -365,6 +365,12 @@
365
365
  "description": "If true, task is hidden from --list output but can still be run directly",
366
366
  "default": false
367
367
  },
368
+ "task_output": {
369
+ "type": "string",
370
+ "enum": ["all", "out", "err", "on-err", "none"],
371
+ "description": "Emit the specified output type(s) from the task. (all: everything, out: only stdout, err: only stderr: on-err: only stderr and only if the task fails, none: emit nothing). This setting can be over-ridden by specifying the command-line option",
372
+ "default": "all"
373
+ },
368
374
  "cmd": {
369
375
  "type": "string",
370
376
  "description": "Shell command to execute. Supports template substitution: {{ arg.name }} for arguments, {{ var.name }} for variables, {{ env.NAME }} for environment variables, {{ dep.task.outputs.name }} for dependency outputs, {{ self.inputs.name }} and {{ self.outputs.name }} for own inputs/outputs, {{ tt.* }} for built-in variables."
@@ -1,6 +1,6 @@
1
1
  """
2
2
  Task Tree - A task automation tool with intelligent incremental execution.
3
- @athena: 1b4a97c4bc42
3
+ @athena: 1f9043e194aa
4
4
  """
5
5
 
6
6
  try: