tx dep block
Add blocking dependencies between tasks
Purpose
tx dep block creates a dependency between two tasks. The blocked task cannot be ready until the blocker is marked done.
tx enforces two rules to maintain consistency:
- No self-blocking: A task cannot block itself
- No cycles: A->B->C->A chains are not allowed
Usage
# Add a blocker: blocker-id must complete before task-id can start
tx dep block <task-id> <blocker-id> [options]
# Remove a blocker
tx dep unblock <task-id> <blocker-id>Arguments
| Argument | Required | Description |
|---|---|---|
<task-id> | Yes | The task that will be blocked |
<blocker-id> | Yes | The task that blocks it |
Options
| Option | Description |
|---|---|
--json | Output as JSON |
--help | Show help |
Examples
# tx-def456 blocks tx-abc123
tx dep block tx-abc123 tx-def456
# Add multiple blockers to a single task
tx dep block tx-feature tx-design
tx dep block tx-feature tx-api
tx dep block tx-feature tx-tests
# Remove a blocker
tx dep unblock tx-abc123 tx-def456import { TxClient } from '@jamesaphoenix/tx-agent-sdk'
const tx = new TxClient({ apiUrl: 'http://localhost:3456' })
// Add blocker: blockerId must complete before id can start
const task = await tx.tasks.block('tx-abc123', 'tx-def456')
// Remove blocker
const task = await tx.tasks.unblock('tx-abc123', 'tx-def456')tx_dep_block
Add a blocking dependency between two tasks.
{
"tool": "tx_dep_block",
"arguments": {
"taskId": "tx-abc123",
"blockerId": "tx-def456"
}
}tx_dep_unblock
Remove a blocking dependency.
{
"tool": "tx_dep_unblock",
"arguments": {
"taskId": "tx-abc123",
"blockerId": "tx-def456"
}
}Add a blocker
POST /api/tasks/:id/block
Content-Type: application/json
{
"blockerId": "tx-def456"
}Remove a blocker
DELETE /api/tasks/:id/block/:blockerIdExample
# Add blocker
curl -X POST http://localhost:3456/api/tasks/tx-abc123/block \
-H "Content-Type: application/json" \
-d '{"blockerId": "tx-def456"}'
# Remove blocker
curl -X DELETE http://localhost:3456/api/tasks/tx-abc123/block/tx-def456Output
Text Output
Dependency added: tx-def456 now blocks tx-abc123
Task tx-abc123:
Status: blocked
Blocked by: tx-def456JSON Output
{
"task": {
"id": "tx-abc123",
"title": "Implement login page",
"status": "blocked",
"blockedBy": ["tx-def456"],
"blocks": [],
"children": [],
"isReady": false
}
}Cycle Detection
tx uses BFS (Breadth-First Search) to detect cycles at insert time:
# This would create a cycle and will be rejected
tx dep block tx-a tx-b
tx dep block tx-b tx-c
tx dep block tx-c tx-a # Error: Would create cycle A->B->C->AError output:
Error: Cannot add dependency - would create cycle: tx-a -> tx-b -> tx-c -> tx-aDependency Visualization
Use tx dep tree to visualize task dependencies:
tx dep tree tx-feature
tx-feature (blocked)
├── tx-design (done) ✓
├── tx-api (active)
└── tx-tests (blocked)
└── tx-unit (ready)Agent Workflow
#!/bin/bash
# Decompose a task into subtasks with dependencies
# Create main task
MAIN=$(tx add "Build user profile page" --json | jq -r '.id')
# Create subtasks
API=$(tx add "Create profile API endpoint" --parent "$MAIN" --json | jq -r '.id')
UI=$(tx add "Build profile UI component" --parent "$MAIN" --json | jq -r '.id')
TEST=$(tx add "Write integration tests" --parent "$MAIN" --json | jq -r '.id')
# Set dependencies: UI depends on API, tests depend on both
tx dep block "$UI" "$API"
tx dep block "$TEST" "$API"
tx dep block "$TEST" "$UI"Related Commands
tx dep unblock- Remove a blocking dependencytx ready- List tasks with no blockerstx done- Complete a task and unblock dependents