gofasta inspect-tasks
Lists every async task registered under app/tasks/ along with its wire name, payload struct, and which parts of the four-part task contract are present. Static AST scan — no running app, no Redis, no devtools required. Sibling of gofasta inspect-jobs for the cron side.
The command walks app/tasks/*.task.go, parses each file, and reports every task that follows gofasta’s g task convention:
const TaskSendWelcomeEmail = "task.send.welcome.email"
type SendWelcomeEmailPayload struct { UserID uuid.UUID; Email string }
func HandleSendWelcomeEmail(ctx context.Context, t *asynq.Task) error { ... }
func EnqueueSendWelcomeEmail(ctx context.Context, q *asynq.Client, p SendWelcomeEmailPayload) (*asynq.TaskInfo, error) { ... }A task is discovered by its Task<Name> constant; the matching <Name>Payload struct, Handle<Name> handler, and Enqueue<Name> helper are paired by name. Each is reported as present or missing — so you can see at a glance whether a task is fully wired or only half-done.
Usage
gofasta inspect-tasks [<name>] [--json]The positional arg filters to one task by either the short name (SendWelcomeEmail) or the Go constant name (TaskSendWelcomeEmail).
Flags
No command-specific flags. Honors the global --json.
Output
Text mode
$ gofasta inspect-tasks
2 task(s) under app/tasks:
SendWelcomeEmail (TaskSendWelcomeEmail)
file: app/tasks/send_welcome_email.task.go
wire_name: task.send.welcome.email
handlers: HandleSendWelcomeEmail + EnqueueSendWelcomeEmail
payload: 2 field(s)
- UserID uuid.UUID
- Email string
CleanupOrphanedFiles (TaskCleanupOrphanedFiles)
file: app/tasks/cleanup_orphaned_files.task.go
wire_name: task.cleanup.orphaned.files
handlers: HandleCleanupOrphanedFiles (missing EnqueueCleanupOrphanedFiles)JSON mode
gofasta inspect-tasks --json{
"tasks_dir": "app/tasks",
"tasks": [
{
"name": "SendWelcomeEmail",
"type_name": "TaskSendWelcomeEmail",
"wire_name": "task.send.welcome.email",
"file": "app/tasks/send_welcome_email.task.go",
"payload": [
{"name": "UserID", "type": "uuid.UUID"},
{"name": "Email", "type": "string"}
],
"has_handler": true,
"has_enqueue": true
}
],
"count": 1
}Examples
List every task:
gofasta inspect-tasksFilter to one task:
gofasta inspect-tasks SendWelcomeEmailFind tasks that have a handler but no enqueuer (half-wired):
gofasta inspect-tasks --json | jq '.tasks[] | select(.has_handler and (.has_enqueue | not))'Find tasks with a specific payload field:
gofasta inspect-tasks --json | jq '.tasks[] | select(.payload[]? | .name == "UserID")'How it works
For each app/tasks/*.task.go (excluding _test.go):
- Parse the file with
go/parser. - Collect
Task<Name>constants. For eachconst TaskFoo = "wire.name"declaration, capture the short name (Foo), the Go identifier (TaskFoo), and the wire-name string literal. - Match payload structs. Look for
<Short>Payloadstruct declarations; record each field’s name + type. - Match handler funcs. Look for
Handle<Short>package-level functions (methods are skipped). - Match enqueue funcs. Look for
Enqueue<Short>package-level functions. - Emit one entry per task with
has_handler/has_enqueueflags so you can spot incomplete tasks.
Methods (functions with a receiver) named HandleFoo don’t count — only package-level functions satisfy the contract. This mirrors gofasta g task’s generator output.
Future: live mode
When the app is reachable and built with devtools, the JSON will additionally include per-task queue depth + recent runs from /debug/tasks. That endpoint isn’t shipped yet.