This example demonstrates the new error reporting and diagnostic features added to taskfile:
check_placeholder_values)The Taskfile uses placeholder patterns that will be detected:
ssh_host: ${STAGING_HOST:-staging.example.com} # ⚠️ Will warn about placeholder
ssh_host: ${PROD_HOST:-your-server.example.com} # ⚠️ Placeholder pattern detected!
Run taskfile doctor to see placeholder warnings with --teach for explanations.
--explain and --teach modes)Preview what will happen without executing:
taskfile run deploy --env staging --explain
See educational explanations of @local/@remote behavior:
taskfile run deploy --env local --teach
The deploy task demonstrates environment-specific command filtering:
tasks:
deploy:
cmds:
- "@local docker compose build" # Skipped on remote envs (with message)
- "@remote docker compose up -d" # Skipped on local envs (with message)
You’ll see explicit skip messages like:
⏭ Pominięto @local (env 'staging' jest zdalny — ma ssh_host)⏭ Pominięto @remote (env 'local' nie ma ssh_host)When commands fail, you get contextual diagnosis:
taskfile run build # If scripts/build.sh is missing
Shows:
teach FieldRun with educational mode:
taskfile doctor --teach
Output shows 3 layers:
Each issue includes a teach explanation when --teach is used.
cd examples/enhanced-error-reporting
taskfile doctor --teach
You’ll see:
your-server.example.com.env.* file warningsscripts/build.sh warningtaskfile run deploy --explain
Shows:
taskfile run deploy --teach
Explains:
# Create missing files
cp .env.example .env.local 2>/dev/null || echo "APP_NAME=myapp" > .env.local
mkdir -p scripts
echo '#!/bin/bash\necho "Building..."' > scripts/build.sh
# Re-run doctor - should have fewer issues
taskfile doctor
teach FieldAll these checks now include educational explanations:
| Check | Issue | teach Explanation |
|---|---|---|
check_preflight |
Missing python3, git, ssh | Why each tool is needed |
check_ssh_keys |
No ~/.ssh or keys | SSH authentication basics |
check_ssh_connectivity |
Connection refused, auth failed | SSH debugging steps |
check_ports |
Port in use | How port binding works |
check_placeholder_values |
example.com, changeme, etc. | What placeholders are |
check_git |
Not a git repo | Why version control matters |
check_dependent_files |
Missing script | script: vs cmds: difference |
After an error, the user knows in 5 seconds what went wrong, if it’s config or bug, and how to fix it.
Try running a task that will fail:
taskfile run build # Will fail - scripts/build.sh doesn't exist
The error output will show: