# =============================================================================
# Base Taskfile — a consistent entry point for any project (Go, Node, or other).
# The dmwd-io standard vocabulary. Every repo exposes the same verbs so a junior
# engineer who learned one project already knows them all. The `desc` on each
# task is the documentation — `task --list` reads like a manual, so nobody has to
# re-explain what these mean:
# task list everything (the default task)
# task setup one-time bootstrap on a fresh clone (.env + install + build)
# task dev local development / watch mode (auto-detects the stack)
# task test run the test suite
# task lint run static analysis
# task build compile / bundle the app
# task prod production build + run
# task reset DESTRUCTIVE — clean, reinstall, re-bootstrap (prompts first)
# Namespaced groups (one file per tool family, included below):
# task docker:* image build / run / compose / push
# task k8s:* cluster ops, manifest apply, and CRD apply (see helm skill)
# Conventions: two-space indent, kebab-case task names, UPPERCASE vars,
# {{.VAR}} templating with no inner spaces, a desc on every USER-FACING task,
# internal: true on helpers, prompt: on anything destructive, and a comment on
# anything non-obvious so `task --list` reads like documentation.
# =============================================================================
# --- Environment ------------------------------------------------------------
# .env is the committed base for local development; .env.local (gitignored)
# overrides it. Listed first = higher precedence. Missing files are ignored by
# Task, so this is safe before any .env exists. `task reset` creates .env from
dotenv: ['.env.local', '.env']
# --- Included task groups ----------------------------------------------------
# Keep this file a readable index. Each tool family lives in its own
# Taskfile.<area>.yml and is included here under its own namespace, so commands
# read as `task docker:build` or `task k8s:pods`. optional: true so a project
# that drops one of these files still works. When a new area grows (db, docs),
# add another include the same way.
taskfile: ./Taskfile.docker.yml
taskfile: ./Taskfile.kubectl.yml
# Namespaced "lints" (plural) to avoid colliding with the root `lint` verb
# below, which fans out to all four. Each one degrades to a skip message,
# never a failure, when that language isn't present in this repo.
taskfile: ./Taskfile.lint.yml
# --- Project configuration ---------------------------------------------------
# Single source of truth for the deploy enum (see the deploy task below).
ALLOWED_ENVS: [dev, staging, prod]
# Defaults exported to every command. Anything set in .env wins over these.
APP_ENV: '{{.APP_ENV | default "development"}}'
desc: List every available task
# --- Lifecycle (the standard dmwd-io verbs) ---------------------------------
desc: One-time bootstrap on a fresh clone (create .env, install deps, build)
desc: Run locally in DEVELOPMENT / watch mode (auto-detects Go / Node / ...)
- ./scripts/run.sh development
desc: Production build then run (auto-detects the stack)
- ./scripts/run.sh production
desc: DESTRUCTIVE — clean, reinstall, and re-bootstrap to a fresh baseline
# prompt: blocks until confirmed because this deletes artifacts and the cache
# and reinstalls from scratch. Skipped under `task --yes` / CI.
prompt: This deletes build artifacts and the .task cache, then reinstalls everything. Continue?
# Helper shared by setup and reset: restore .env and install dependencies.
# internal so it never shows in `task --list` — call setup or reset instead.
# --- Build / quality (shown for Go — swap the commands for your stack) ------
desc: Compile / bundle the app (incremental — skipped when sources are unchanged)
- exclude: '**/*_test.go'
- '{{.BIN_DIR}}/{{.APP_NAME}}'
- go build -o {{.BIN_DIR}}/{{.APP_NAME}} .
desc: Run the test suite (extra args pass through after --)
- go test ./... {{.CLI_ARGS}}
desc: Run every lint that applies to this repo (Go / Python / JS-TS-React / docs) — one command, auto-skips languages this repo doesn't use
# --- Deploy (required + enum-validated input, conditional step) -------------
desc: Deploy to an environment (validated against ALLOWED_ENVS, confirms first)
# enum.ref reuses the ALLOWED_ENVS var instead of duplicating the list.
msg: a .env file is required before deploy (run task reset)
prompt: Deploy to {{.ENVIRONMENT}} now?
# This command only runs for prod — an if/else-style guard via if:.
- cmd: echo "Running production smoke checks first"
if: '{{eq .ENVIRONMENT "prod"}}'
- ./scripts/deploy.sh {{.ENVIRONMENT}}