trak_flow 0.1.3

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 (95) hide show
  1. checksums.yaml +7 -0
  2. data/.envrc +3 -0
  3. data/CHANGELOG.md +69 -0
  4. data/COMMITS.md +196 -0
  5. data/Gemfile +8 -0
  6. data/Gemfile.lock +281 -0
  7. data/README.md +479 -0
  8. data/Rakefile +16 -0
  9. data/bin/tf +6 -0
  10. data/bin/tf_mcp +81 -0
  11. data/docs/.keep +0 -0
  12. data/docs/api/database.md +434 -0
  13. data/docs/api/ruby-library.md +349 -0
  14. data/docs/api/task-model.md +341 -0
  15. data/docs/assets/stylesheets/extra.css +53 -0
  16. data/docs/assets/trak_flow.jpg +0 -0
  17. data/docs/cli/admin-commands.md +369 -0
  18. data/docs/cli/dependency-commands.md +321 -0
  19. data/docs/cli/label-commands.md +222 -0
  20. data/docs/cli/overview.md +163 -0
  21. data/docs/cli/plan-commands.md +344 -0
  22. data/docs/cli/task-commands.md +333 -0
  23. data/docs/core-concepts/dependencies.md +232 -0
  24. data/docs/core-concepts/labels.md +217 -0
  25. data/docs/core-concepts/overview.md +178 -0
  26. data/docs/core-concepts/plans-workflows.md +264 -0
  27. data/docs/core-concepts/tasks.md +205 -0
  28. data/docs/getting-started/configuration.md +120 -0
  29. data/docs/getting-started/installation.md +79 -0
  30. data/docs/getting-started/quick-start.md +245 -0
  31. data/docs/index.md +169 -0
  32. data/docs/mcp/integration.md +302 -0
  33. data/docs/mcp/overview.md +206 -0
  34. data/docs/mcp/resources.md +284 -0
  35. data/docs/mcp/tools.md +457 -0
  36. data/examples/basic_usage.rb +365 -0
  37. data/examples/cli_demo.sh +314 -0
  38. data/examples/mcp/Gemfile +9 -0
  39. data/examples/mcp/Gemfile.lock +226 -0
  40. data/examples/mcp/http_demo.rb +232 -0
  41. data/examples/mcp/stdio_demo.rb +146 -0
  42. data/lib/trak_flow/cli/admin_commands.rb +136 -0
  43. data/lib/trak_flow/cli/config_commands.rb +260 -0
  44. data/lib/trak_flow/cli/dep_commands.rb +71 -0
  45. data/lib/trak_flow/cli/label_commands.rb +76 -0
  46. data/lib/trak_flow/cli/main_commands.rb +386 -0
  47. data/lib/trak_flow/cli/plan_commands.rb +185 -0
  48. data/lib/trak_flow/cli/workflow_commands.rb +133 -0
  49. data/lib/trak_flow/cli.rb +110 -0
  50. data/lib/trak_flow/config/defaults.yml +114 -0
  51. data/lib/trak_flow/config/section.rb +74 -0
  52. data/lib/trak_flow/config.rb +276 -0
  53. data/lib/trak_flow/graph/dependency_graph.rb +288 -0
  54. data/lib/trak_flow/id_generator.rb +52 -0
  55. data/lib/trak_flow/mcp/resources/base_resource.rb +25 -0
  56. data/lib/trak_flow/mcp/resources/dependency_graph.rb +31 -0
  57. data/lib/trak_flow/mcp/resources/label_list.rb +21 -0
  58. data/lib/trak_flow/mcp/resources/plan_by_id.rb +27 -0
  59. data/lib/trak_flow/mcp/resources/plan_list.rb +21 -0
  60. data/lib/trak_flow/mcp/resources/task_by_id.rb +31 -0
  61. data/lib/trak_flow/mcp/resources/task_list.rb +21 -0
  62. data/lib/trak_flow/mcp/resources/task_next.rb +30 -0
  63. data/lib/trak_flow/mcp/resources/workflow_by_id.rb +27 -0
  64. data/lib/trak_flow/mcp/resources/workflow_list.rb +21 -0
  65. data/lib/trak_flow/mcp/server.rb +140 -0
  66. data/lib/trak_flow/mcp/tools/base_tool.rb +29 -0
  67. data/lib/trak_flow/mcp/tools/comment_add.rb +33 -0
  68. data/lib/trak_flow/mcp/tools/dep_add.rb +34 -0
  69. data/lib/trak_flow/mcp/tools/dep_remove.rb +25 -0
  70. data/lib/trak_flow/mcp/tools/label_add.rb +28 -0
  71. data/lib/trak_flow/mcp/tools/label_remove.rb +25 -0
  72. data/lib/trak_flow/mcp/tools/plan_add_step.rb +35 -0
  73. data/lib/trak_flow/mcp/tools/plan_create.rb +33 -0
  74. data/lib/trak_flow/mcp/tools/plan_run.rb +58 -0
  75. data/lib/trak_flow/mcp/tools/plan_start.rb +58 -0
  76. data/lib/trak_flow/mcp/tools/task_block.rb +27 -0
  77. data/lib/trak_flow/mcp/tools/task_close.rb +26 -0
  78. data/lib/trak_flow/mcp/tools/task_create.rb +51 -0
  79. data/lib/trak_flow/mcp/tools/task_defer.rb +27 -0
  80. data/lib/trak_flow/mcp/tools/task_start.rb +25 -0
  81. data/lib/trak_flow/mcp/tools/task_update.rb +36 -0
  82. data/lib/trak_flow/mcp/tools/workflow_discard.rb +28 -0
  83. data/lib/trak_flow/mcp/tools/workflow_summarize.rb +34 -0
  84. data/lib/trak_flow/mcp.rb +38 -0
  85. data/lib/trak_flow/models/comment.rb +71 -0
  86. data/lib/trak_flow/models/dependency.rb +96 -0
  87. data/lib/trak_flow/models/label.rb +90 -0
  88. data/lib/trak_flow/models/task.rb +188 -0
  89. data/lib/trak_flow/storage/database.rb +638 -0
  90. data/lib/trak_flow/storage/jsonl.rb +259 -0
  91. data/lib/trak_flow/time_parser.rb +15 -0
  92. data/lib/trak_flow/version.rb +5 -0
  93. data/lib/trak_flow.rb +100 -0
  94. data/mkdocs.yml +143 -0
  95. metadata +392 -0
@@ -0,0 +1,53 @@
1
+ /* Hero section grid layout */
2
+ .md-content .grid {
3
+ display: grid;
4
+ grid-template-columns: 1fr 1fr;
5
+ gap: 2rem;
6
+ align-items: start;
7
+ }
8
+
9
+ /* Responsive: stack on mobile */
10
+ @media screen and (max-width: 768px) {
11
+ .md-content .grid {
12
+ grid-template-columns: 1fr;
13
+ }
14
+ }
15
+
16
+ /* Hero image styling */
17
+ .md-content .grid img {
18
+ border-radius: 8px;
19
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
20
+ }
21
+
22
+ /* Definition list in hero - more compact */
23
+ .md-content .grid dl {
24
+ margin: 1rem 0;
25
+ }
26
+
27
+ .md-content .grid dt {
28
+ margin-top: 0.5rem;
29
+ font-weight: 600;
30
+ }
31
+
32
+ .md-content .grid dd {
33
+ margin-left: 1.5rem;
34
+ margin-bottom: 0.25rem;
35
+ font-size: 0.9rem;
36
+ opacity: 0.85;
37
+ }
38
+
39
+ /* Button spacing */
40
+ .md-content .md-button {
41
+ margin-right: 0.5rem;
42
+ margin-top: 1rem;
43
+ }
44
+
45
+ /* Make icons in definition list slightly larger */
46
+ .md-content .grid dt .twemoji,
47
+ .md-content .grid dt .emojione,
48
+ .md-content .grid dt svg {
49
+ height: 1.2rem;
50
+ width: 1.2rem;
51
+ vertical-align: text-bottom;
52
+ margin-right: 0.3rem;
53
+ }
Binary file
@@ -0,0 +1,369 @@
1
+ # Admin Commands
2
+
3
+ Commands for system administration, data management, and analysis.
4
+
5
+ ## Initialize TrakFlow
6
+
7
+ Set up TrakFlow in a project directory.
8
+
9
+ ```bash
10
+ tf admin init [OPTIONS]
11
+ ```
12
+
13
+ ### Options
14
+
15
+ | Option | Description |
16
+ |--------|-------------|
17
+ | `--force` | Overwrite existing configuration |
18
+ | `--dir` | Custom data directory (default: `.trak_flow`) |
19
+
20
+ ### Examples
21
+
22
+ ```bash
23
+ # Initialize in current directory
24
+ tf admin init
25
+
26
+ # Use custom directory
27
+ tf admin init --dir .tasks
28
+
29
+ # Reinitialize (overwrite)
30
+ tf admin init --force
31
+ ```
32
+
33
+ ### Created Structure
34
+
35
+ ```
36
+ .trak_flow/
37
+ ├── issues.jsonl # Task data
38
+ ├── trak_flow.db # SQLite cache
39
+ └── config.json # Configuration
40
+ ```
41
+
42
+ ## Export Data
43
+
44
+ Export tasks to JSONL format.
45
+
46
+ ```bash
47
+ tf admin export [OPTIONS]
48
+ ```
49
+
50
+ ### Options
51
+
52
+ | Option | Description |
53
+ |--------|-------------|
54
+ | `--output`, `-o` | Output file (default: stdout) |
55
+ | `--format` | Output format (jsonl, json) |
56
+ | `--status` | Filter by status |
57
+ | `--type` | Filter by type |
58
+ | `--include-closed` | Include closed tasks |
59
+
60
+ ### Examples
61
+
62
+ ```bash
63
+ # Export to stdout
64
+ tf admin export
65
+
66
+ # Export to file
67
+ tf admin export -o backup.jsonl
68
+
69
+ # Export only open tasks
70
+ tf admin export --status open
71
+
72
+ # Export as JSON array
73
+ tf admin export --format json
74
+ ```
75
+
76
+ ## Import Data
77
+
78
+ Import tasks from JSONL format.
79
+
80
+ ```bash
81
+ tf admin import FILE [OPTIONS]
82
+ ```
83
+
84
+ ### Options
85
+
86
+ | Option | Description |
87
+ |--------|-------------|
88
+ | `--merge` | Merge with existing data |
89
+ | `--replace` | Replace all existing data |
90
+ | `--dry-run` | Show what would be imported |
91
+
92
+ ### Examples
93
+
94
+ ```bash
95
+ # Import and merge
96
+ tf admin import backup.jsonl --merge
97
+
98
+ # Replace all data
99
+ tf admin import backup.jsonl --replace
100
+
101
+ # Preview import
102
+ tf admin import backup.jsonl --dry-run
103
+ ```
104
+
105
+ ## Generate Dependency Graph
106
+
107
+ Create a visual representation of task dependencies.
108
+
109
+ ```bash
110
+ tf admin graph [OPTIONS]
111
+ ```
112
+
113
+ ### Options
114
+
115
+ | Option | Description |
116
+ |--------|-------------|
117
+ | `--format` | Output format: dot, svg, png (default: dot) |
118
+ | `--output`, `-o` | Output file |
119
+ | `--filter` | Filter expression |
120
+ | `--cluster` | Group by label or type |
121
+
122
+ ### Examples
123
+
124
+ ```bash
125
+ # DOT format to stdout
126
+ tf admin graph
127
+
128
+ # Generate SVG
129
+ tf admin graph --format svg -o deps.svg
130
+
131
+ # Generate PNG
132
+ tf admin graph --format png -o deps.png
133
+
134
+ # Filter by status
135
+ tf admin graph --filter "status=open"
136
+
137
+ # Cluster by type
138
+ tf admin graph --cluster type
139
+ ```
140
+
141
+ ### Using Graphviz
142
+
143
+ If you have Graphviz installed:
144
+
145
+ ```bash
146
+ # Generate and render in one step
147
+ tf admin graph | dot -Tsvg -o deps.svg
148
+
149
+ # View immediately (macOS)
150
+ tf admin graph | dot -Tpng | open -f -a Preview
151
+ ```
152
+
153
+ ## Analyze Project
154
+
155
+ Analyze project health and statistics.
156
+
157
+ ```bash
158
+ tf admin analyze [OPTIONS]
159
+ ```
160
+
161
+ ### Options
162
+
163
+ | Option | Description |
164
+ |--------|-------------|
165
+ | `--json` | Output as JSON |
166
+
167
+ ### Output
168
+
169
+ ```
170
+ TrakFlow Project Analysis
171
+ =========================
172
+
173
+ Tasks: 47
174
+ - open: 12
175
+ - in_progress: 5
176
+ - blocked: 3
177
+ - closed: 27
178
+
179
+ Types:
180
+ - task: 30
181
+ - bug: 8
182
+ - feature: 5
183
+ - epic: 3
184
+ - chore: 1
185
+
186
+ Priorities:
187
+ - critical (0): 2
188
+ - high (1): 8
189
+ - medium (2): 25
190
+ - low (3): 10
191
+ - backlog (4): 2
192
+
193
+ Dependencies:
194
+ - Total relationships: 34
195
+ - Orphan tasks: 5
196
+ - Circular dependencies: 0
197
+
198
+ Labels:
199
+ - Most used: frontend (12), backend (8), urgent (3)
200
+ - Unused labels: 0
201
+
202
+ Plans:
203
+ - Blueprints: 3
204
+ - Active workflows: 2
205
+ - Ephemeral workflows: 1
206
+
207
+ Health Score: 85/100
208
+ - No circular dependencies ✓
209
+ - Few blocked tasks ✓
210
+ - Good label usage ✓
211
+ - Recommendation: Close stale tasks (5 tasks open > 30 days)
212
+ ```
213
+
214
+ ## Rebuild Cache
215
+
216
+ Rebuild the SQLite cache from JSONL source.
217
+
218
+ ```bash
219
+ tf admin rebuild
220
+ ```
221
+
222
+ The cache is normally rebuilt automatically, but this forces a full rebuild.
223
+
224
+ ## Archive Tasks
225
+
226
+ Archive old closed tasks.
227
+
228
+ ```bash
229
+ tf admin archive [OPTIONS]
230
+ ```
231
+
232
+ ### Options
233
+
234
+ | Option | Description |
235
+ |--------|-------------|
236
+ | `--older-than` | Age threshold (default: 90d) |
237
+ | `--status` | Archive tasks with status |
238
+ | `--dry-run` | Show what would be archived |
239
+
240
+ ### Examples
241
+
242
+ ```bash
243
+ # Archive tasks closed > 90 days ago
244
+ tf admin archive
245
+
246
+ # Archive tasks closed > 30 days ago
247
+ tf admin archive --older-than 30d
248
+
249
+ # Preview
250
+ tf admin archive --dry-run
251
+ ```
252
+
253
+ Archived tasks are marked with status `tombstone` and excluded from normal queries.
254
+
255
+ ## Garbage Collection
256
+
257
+ Clean up ephemeral workflows and temporary data.
258
+
259
+ ```bash
260
+ tf admin gc [OPTIONS]
261
+ ```
262
+
263
+ ### Options
264
+
265
+ | Option | Description |
266
+ |--------|-------------|
267
+ | `--older-than` | Age threshold (default: 7d) |
268
+ | `--dry-run` | Show what would be deleted |
269
+
270
+ ### Examples
271
+
272
+ ```bash
273
+ # Default cleanup
274
+ tf admin gc
275
+
276
+ # More aggressive
277
+ tf admin gc --older-than 24h
278
+
279
+ # Preview
280
+ tf admin gc --dry-run
281
+ ```
282
+
283
+ ## Configuration
284
+
285
+ ### View Configuration
286
+
287
+ ```bash
288
+ tf admin config
289
+ ```
290
+
291
+ ### Set Configuration
292
+
293
+ ```bash
294
+ tf admin config KEY VALUE
295
+ ```
296
+
297
+ ### Examples
298
+
299
+ ```bash
300
+ # View all settings
301
+ tf admin config
302
+
303
+ # Set default priority
304
+ tf admin config default_priority 2
305
+
306
+ # Set retention period
307
+ tf admin config gc_retention 7d
308
+ ```
309
+
310
+ ## Validate Data
311
+
312
+ Check data integrity.
313
+
314
+ ```bash
315
+ tf admin validate
316
+ ```
317
+
318
+ ### Checks Performed
319
+
320
+ - JSONL syntax validity
321
+ - Required fields present
322
+ - Valid status values
323
+ - Valid priority values
324
+ - Valid type values
325
+ - Reference integrity (parent_id, dependencies)
326
+ - No circular dependencies
327
+
328
+ ### Output
329
+
330
+ ```
331
+ Validation Results
332
+ ==================
333
+
334
+ ✓ JSONL syntax: valid
335
+ ✓ Required fields: present
336
+ ✓ Status values: valid
337
+ ✓ Priority values: valid
338
+ ✓ Type values: valid
339
+ ✓ Parent references: valid
340
+ ✓ Dependency references: valid
341
+ ✓ No circular dependencies
342
+
343
+ All checks passed!
344
+ ```
345
+
346
+ ## Backup and Restore
347
+
348
+ ### Create Backup
349
+
350
+ ```bash
351
+ tf admin export -o "backup-$(date +%Y%m%d).jsonl"
352
+ ```
353
+
354
+ ### Restore from Backup
355
+
356
+ ```bash
357
+ tf admin import backup-20240115.jsonl --replace
358
+ tf admin rebuild
359
+ ```
360
+
361
+ ### Automated Backups
362
+
363
+ Add to your git workflow:
364
+
365
+ ```bash
366
+ # .git/hooks/pre-commit
367
+ #!/bin/bash
368
+ cp .trak_flow/issues.jsonl .trak_flow/issues.jsonl.bak
369
+ ```
@@ -0,0 +1,321 @@
1
+ # Dependency Commands
2
+
3
+ Commands for managing task dependencies and relationships.
4
+
5
+ ## Add Dependency
6
+
7
+ Create a dependency between tasks.
8
+
9
+ ```bash
10
+ tf dep add SOURCE TARGET [OPTIONS]
11
+ ```
12
+
13
+ The SOURCE task blocks/relates-to the TARGET task.
14
+
15
+ ### Options
16
+
17
+ | Option | Short | Description |
18
+ |--------|-------|-------------|
19
+ | `--type` | `-t` | Dependency type |
20
+
21
+ ### Dependency Types
22
+
23
+ | Type | Description |
24
+ |------|-------------|
25
+ | `blocks` | Hard dependency (default) - SOURCE must complete before TARGET |
26
+ | `related` | Soft link - Reference between related tasks |
27
+ | `parent-child` | Hierarchical relationship |
28
+ | `discovered-from` | Traceability - Track where a task originated |
29
+
30
+ ### Examples
31
+
32
+ ```bash
33
+ # Design must complete before implementation
34
+ tf dep add tf-design tf-implement
35
+
36
+ # Explicit blocking dependency
37
+ tf dep add tf-design tf-implement --type blocks
38
+
39
+ # Related tasks (soft link)
40
+ tf dep add tf-bug1 tf-bug2 -t related
41
+
42
+ # Track origin
43
+ tf dep add tf-issue123 tf-task456 -t discovered-from
44
+ ```
45
+
46
+ ## Remove Dependency
47
+
48
+ Remove a dependency between tasks.
49
+
50
+ ```bash
51
+ tf dep remove SOURCE TARGET
52
+ ```
53
+
54
+ ### Examples
55
+
56
+ ```bash
57
+ tf dep remove tf-design tf-implement
58
+ ```
59
+
60
+ ## View Dependency Tree
61
+
62
+ Show dependencies for a task.
63
+
64
+ ```bash
65
+ tf dep tree TASK_ID [OPTIONS]
66
+ ```
67
+
68
+ ### Options
69
+
70
+ | Option | Description |
71
+ |--------|-------------|
72
+ | `--depth` | Maximum depth to display |
73
+ | `--all` | Include all dependency types |
74
+
75
+ ### Output
76
+
77
+ ```
78
+ tf-implement
79
+ ├── blocked by:
80
+ │ └── tf-design (closed)
81
+ │ └── tf-research (closed)
82
+ └── blocks:
83
+ ├── tf-test (open)
84
+ │ └── tf-deploy (open)
85
+ └── tf-docs (open)
86
+ ```
87
+
88
+ ## Find Ready Tasks
89
+
90
+ Find tasks with no open blocking dependencies.
91
+
92
+ ```bash
93
+ tf ready [OPTIONS]
94
+ ```
95
+
96
+ A task is "ready" when:
97
+ - Status is `open`
98
+ - All blocking dependencies are `closed`
99
+ - Not a Plan (Plans can't be executed directly)
100
+
101
+ ### Options
102
+
103
+ | Option | Short | Description |
104
+ |--------|-------|-------------|
105
+ | `--type` | `-t` | Filter by type |
106
+ | `--priority` | `-p` | Filter by priority |
107
+ | `--assignee` | `-a` | Filter by assignee |
108
+ | `--label` | `-l` | Filter by label |
109
+ | `--limit` | `-n` | Max results |
110
+
111
+ ### Examples
112
+
113
+ ```bash
114
+ # All ready tasks
115
+ tf ready
116
+
117
+ # Ready bugs
118
+ tf ready -t bug
119
+
120
+ # Ready high-priority
121
+ tf ready -p 0,1
122
+
123
+ # Top 5 ready tasks
124
+ tf ready -n 5
125
+ ```
126
+
127
+ ## Dependency Graph
128
+
129
+ Generate a visual dependency graph.
130
+
131
+ ```bash
132
+ tf admin graph [OPTIONS]
133
+ ```
134
+
135
+ ### Options
136
+
137
+ | Option | Description |
138
+ |--------|-------------|
139
+ | `--format` | Output format (dot, svg, png) |
140
+ | `--output` | Output file path |
141
+ | `--filter` | Filter expression |
142
+
143
+ ### Examples
144
+
145
+ ```bash
146
+ # Generate DOT format to stdout
147
+ tf admin graph
148
+
149
+ # Generate SVG file
150
+ tf admin graph --format svg --output deps.svg
151
+
152
+ # Generate PNG file
153
+ tf admin graph --format png --output deps.png
154
+
155
+ # Filter by status
156
+ tf admin graph --filter "status=open"
157
+ ```
158
+
159
+ ### DOT Output
160
+
161
+ ```dot
162
+ digraph dependencies {
163
+ rankdir=LR;
164
+ node [shape=box];
165
+
166
+ "tf-design" [label="Design API" style=filled fillcolor=lightgreen];
167
+ "tf-implement" [label="Implement API" style=filled fillcolor=lightyellow];
168
+ "tf-test" [label="Write Tests"];
169
+ "tf-docs" [label="Update Docs"];
170
+
171
+ "tf-design" -> "tf-implement";
172
+ "tf-implement" -> "tf-test";
173
+ "tf-implement" -> "tf-docs";
174
+ }
175
+ ```
176
+
177
+ ## Common Patterns
178
+
179
+ ### Sequential Workflow
180
+
181
+ Tasks that must be done in order:
182
+
183
+ ```bash
184
+ tf create "Step 1: Research"
185
+ tf create "Step 2: Design"
186
+ tf create "Step 3: Implement"
187
+ tf create "Step 4: Test"
188
+
189
+ tf dep add tf-step1 tf-step2
190
+ tf dep add tf-step2 tf-step3
191
+ tf dep add tf-step3 tf-step4
192
+ ```
193
+
194
+ ```
195
+ Research → Design → Implement → Test
196
+ ```
197
+
198
+ ### Parallel Tasks with Sync Point
199
+
200
+ Multiple tasks that converge:
201
+
202
+ ```bash
203
+ tf create "Frontend work"
204
+ tf create "Backend work"
205
+ tf create "Integration"
206
+
207
+ tf dep add tf-frontend tf-integration
208
+ tf dep add tf-backend tf-integration
209
+ ```
210
+
211
+ ```
212
+ Frontend ─┐
213
+ ├→ Integration
214
+ Backend ─┘
215
+ ```
216
+
217
+ ### Feature with Prerequisites
218
+
219
+ A feature that requires setup first:
220
+
221
+ ```bash
222
+ tf create "Add payment support" -t feature
223
+ tf create "Set up Stripe account"
224
+ tf create "Get API keys"
225
+ tf create "Implement payment flow"
226
+
227
+ tf dep add tf-stripe tf-implement
228
+ tf dep add tf-keys tf-implement
229
+ ```
230
+
231
+ ```
232
+ Stripe Account ─┐
233
+ ├→ Implement Payment
234
+ Get API Keys ──┘
235
+ ```
236
+
237
+ ### Epic with Subtasks
238
+
239
+ Breaking down a large task:
240
+
241
+ ```bash
242
+ tf create "User Authentication" -t epic
243
+ tf create "Login page" --parent tf-auth
244
+ tf create "Logout" --parent tf-auth
245
+ tf create "Password reset" --parent tf-auth
246
+
247
+ # Login before logout
248
+ tf dep add tf-login tf-logout
249
+ ```
250
+
251
+ ## Validation
252
+
253
+ TrakFlow validates dependencies:
254
+
255
+ | Rule | Error |
256
+ |------|-------|
257
+ | No self-reference | "Cannot add dependency to itself" |
258
+ | Tasks must exist | "Task not found: {id}" |
259
+ | No cycles (optional) | "Creates circular dependency" |
260
+
261
+ ### Cycle Detection
262
+
263
+ TrakFlow can detect circular dependencies:
264
+
265
+ ```bash
266
+ # This would create a cycle: A → B → C → A
267
+ tf dep add tf-c tf-a
268
+ # Warning: Creates circular dependency
269
+ ```
270
+
271
+ ## Query Dependencies
272
+
273
+ ### Find Blocked Tasks
274
+
275
+ ```bash
276
+ tf list --status blocked
277
+ ```
278
+
279
+ ### Find Tasks Blocking Others
280
+
281
+ ```bash
282
+ tf dep tree tf-abc123
283
+ ```
284
+
285
+ ### Find Orphan Tasks
286
+
287
+ Tasks with no dependencies:
288
+
289
+ ```bash
290
+ tf admin analyze
291
+ ```
292
+
293
+ ## Impact on Operations
294
+
295
+ ### Closing Tasks
296
+
297
+ When you close a task, dependent tasks may become ready:
298
+
299
+ ```bash
300
+ tf close tf-design
301
+ # tf-implement is now ready (if it was only blocked by tf-design)
302
+ ```
303
+
304
+ ### Reopening Tasks
305
+
306
+ Reopening a task re-blocks its dependents:
307
+
308
+ ```bash
309
+ tf reopen tf-design
310
+ # tf-implement is blocked again
311
+ ```
312
+
313
+ ## Best Practices
314
+
315
+ 1. **Keep graphs simple** - Avoid overly complex chains
316
+ 2. **Use meaningful types** - Choose the right dependency type
317
+ 3. **Document why** - Add notes explaining dependencies
318
+ 4. **Review regularly** - Clean up stale dependencies
319
+ 5. **Check for cycles** - Before adding dependencies
320
+ 6. **Don't over-connect** - Not everything needs to be linked
321
+ 7. **Use labels for grouping** - Instead of `related` dependencies for categorization