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,333 @@
1
+ # Task Commands
2
+
3
+ Commands for creating and managing tasks.
4
+
5
+ ## Create Task
6
+
7
+ Create a new task.
8
+
9
+ ```bash
10
+ tf create TITLE [OPTIONS]
11
+ ```
12
+
13
+ ### Options
14
+
15
+ | Option | Short | Description |
16
+ |--------|-------|-------------|
17
+ | `--description` | `-d` | Detailed description |
18
+ | `--type` | `-t` | Task type (task, bug, feature, epic, chore) |
19
+ | `--priority` | `-p` | Priority level (0-4) |
20
+ | `--assignee` | `-a` | Assign to user/agent |
21
+ | `--parent` | | Parent task ID for hierarchy |
22
+ | `--plan` | | Create as a Plan blueprint |
23
+
24
+ ### Examples
25
+
26
+ ```bash
27
+ # Basic task
28
+ tf create "Fix login bug"
29
+
30
+ # With type and priority
31
+ tf create "Security vulnerability" -t bug -p 0
32
+
33
+ # With description
34
+ tf create "Add OAuth" -d "Implement OAuth 2.0 with Google and GitHub providers"
35
+
36
+ # Child task
37
+ tf create "Design login page" --parent tf-abc123
38
+
39
+ # Create a Plan
40
+ tf create "Release Checklist" --plan
41
+ ```
42
+
43
+ ## List Tasks
44
+
45
+ List tasks with filtering options.
46
+
47
+ ```bash
48
+ tf list [OPTIONS]
49
+ ```
50
+
51
+ ### Options
52
+
53
+ | Option | Short | Description |
54
+ |--------|-------|-------------|
55
+ | `--status` | `-s` | Filter by status |
56
+ | `--type` | `-t` | Filter by type |
57
+ | `--priority` | `-p` | Filter by priority |
58
+ | `--assignee` | `-a` | Filter by assignee |
59
+ | `--label` | `-l` | Filter by label (repeatable) |
60
+ | `--parent` | | Show only children of task |
61
+ | `--no-children` | | Exclude child tasks |
62
+ | `--json` | | Output as JSON |
63
+
64
+ ### Examples
65
+
66
+ ```bash
67
+ # All open tasks
68
+ tf list
69
+
70
+ # By status
71
+ tf list --status in_progress
72
+ tf list -s blocked
73
+
74
+ # By type
75
+ tf list --type bug
76
+ tf list -t feature
77
+
78
+ # By priority
79
+ tf list --priority 0
80
+ tf list -p high
81
+
82
+ # By label
83
+ tf list --label frontend
84
+ tf list -l urgent -l frontend
85
+
86
+ # Combine filters
87
+ tf list -s open -t bug -p 0
88
+
89
+ # JSON output
90
+ tf list --json
91
+ ```
92
+
93
+ ### Status Values
94
+
95
+ - `open` - Ready to work on
96
+ - `in_progress` - Currently being worked on
97
+ - `blocked` - Waiting on something
98
+ - `deferred` - Postponed
99
+ - `closed` - Completed
100
+ - `all` - Include all statuses
101
+
102
+ ## Show Task
103
+
104
+ Display detailed information about a task.
105
+
106
+ ```bash
107
+ tf show TASK_ID [OPTIONS]
108
+ ```
109
+
110
+ ### Options
111
+
112
+ | Option | Description |
113
+ |--------|-------------|
114
+ | `--tree` | Show child tasks in tree format |
115
+ | `--deps` | Show dependencies |
116
+ | `--json` | Output as JSON |
117
+
118
+ ### Examples
119
+
120
+ ```bash
121
+ tf show tf-abc123
122
+
123
+ tf show tf-abc123 --tree
124
+
125
+ tf show tf-abc123 --deps
126
+ ```
127
+
128
+ ### Output
129
+
130
+ ```
131
+ Task: tf-abc123
132
+ Title: Implement user authentication
133
+ Type: feature
134
+ Status: in_progress
135
+ Priority: 1 (high)
136
+ Assignee: claude
137
+ Created: 2024-01-15 10:00:00
138
+ Updated: 2024-01-16 14:30:00
139
+
140
+ Description:
141
+ Add authentication system with login, logout, and session management.
142
+
143
+ Labels:
144
+ - backend
145
+ - security
146
+
147
+ Dependencies:
148
+ Blocked by:
149
+ - tf-design1 (closed)
150
+ Blocks:
151
+ - tf-test1 (open)
152
+ - tf-docs1 (open)
153
+
154
+ Notes:
155
+ [2024-01-16T14:30:00Z] [STARTED] Beginning implementation
156
+ [2024-01-15T10:00:00Z] [CREATED] Initial task creation
157
+ ```
158
+
159
+ ## Update Task
160
+
161
+ Modify task properties.
162
+
163
+ ```bash
164
+ tf update TASK_ID [OPTIONS]
165
+ ```
166
+
167
+ ### Options
168
+
169
+ | Option | Short | Description |
170
+ |--------|-------|-------------|
171
+ | `--title` | | New title |
172
+ | `--description` | `-d` | New description |
173
+ | `--type` | `-t` | New type |
174
+ | `--priority` | `-p` | New priority |
175
+ | `--assignee` | `-a` | New assignee |
176
+ | `--notes` | `-n` | Append to notes |
177
+
178
+ ### Examples
179
+
180
+ ```bash
181
+ # Change title
182
+ tf update tf-abc123 --title "New title"
183
+
184
+ # Change priority
185
+ tf update tf-abc123 -p 0
186
+
187
+ # Add notes
188
+ tf update tf-abc123 --notes "Waiting for design review"
189
+
190
+ # Change assignee
191
+ tf update tf-abc123 -a alice
192
+ ```
193
+
194
+ ## Status Commands
195
+
196
+ ### Start Task
197
+
198
+ Mark a task as in progress.
199
+
200
+ ```bash
201
+ tf start TASK_ID
202
+ ```
203
+
204
+ ### Block Task
205
+
206
+ Mark a task as blocked.
207
+
208
+ ```bash
209
+ tf block TASK_ID [--reason "reason"]
210
+ ```
211
+
212
+ ### Defer Task
213
+
214
+ Postpone a task.
215
+
216
+ ```bash
217
+ tf defer TASK_ID [--until DATE]
218
+ ```
219
+
220
+ ### Close Task
221
+
222
+ Complete a task.
223
+
224
+ ```bash
225
+ tf close TASK_ID [--summary "completion summary"]
226
+ ```
227
+
228
+ ### Reopen Task
229
+
230
+ Reopen a closed or deferred task.
231
+
232
+ ```bash
233
+ tf reopen TASK_ID
234
+ ```
235
+
236
+ ### Examples
237
+
238
+ ```bash
239
+ # Start working
240
+ tf start tf-abc123
241
+
242
+ # Hit a blocker
243
+ tf block tf-abc123 --reason "Waiting for API access"
244
+
245
+ # Postpone
246
+ tf defer tf-abc123 --until "next week"
247
+
248
+ # Complete
249
+ tf close tf-abc123 --summary "Implemented in PR #42"
250
+
251
+ # Reopen
252
+ tf reopen tf-abc123
253
+ ```
254
+
255
+ ## Find Ready Tasks
256
+
257
+ Find tasks that are ready to work on (no open blockers).
258
+
259
+ ```bash
260
+ tf ready [OPTIONS]
261
+ ```
262
+
263
+ ### Options
264
+
265
+ | Option | Short | Description |
266
+ |--------|-------|-------------|
267
+ | `--type` | `-t` | Filter by type |
268
+ | `--priority` | `-p` | Filter by priority |
269
+ | `--assignee` | `-a` | Filter by assignee |
270
+ | `--label` | `-l` | Filter by label |
271
+ | `--limit` | `-n` | Max results |
272
+
273
+ ### Examples
274
+
275
+ ```bash
276
+ # All ready tasks
277
+ tf ready
278
+
279
+ # Ready bugs
280
+ tf ready -t bug
281
+
282
+ # Ready high-priority tasks
283
+ tf ready -p 0,1
284
+
285
+ # Top 5 ready tasks
286
+ tf ready -n 5
287
+ ```
288
+
289
+ ## Delete Task
290
+
291
+ Remove a task permanently.
292
+
293
+ ```bash
294
+ tf delete TASK_ID [--force]
295
+ ```
296
+
297
+ !!! warning
298
+ This is destructive. Use `--force` to skip confirmation.
299
+
300
+ ### Examples
301
+
302
+ ```bash
303
+ # With confirmation
304
+ tf delete tf-abc123
305
+
306
+ # Without confirmation
307
+ tf delete tf-abc123 --force
308
+ ```
309
+
310
+ ## Bulk Operations
311
+
312
+ ### Using Shell Loops
313
+
314
+ ```bash
315
+ # Close all tasks with a label
316
+ tf list --label sprint-42 --json | \
317
+ jq -r '.[].id' | \
318
+ xargs -I {} tf close {}
319
+
320
+ # Add label to multiple tasks
321
+ for id in tf-abc123 tf-def456 tf-ghi789; do
322
+ tf label add $id "urgent"
323
+ done
324
+ ```
325
+
326
+ ### Using xargs
327
+
328
+ ```bash
329
+ # Defer all low-priority tasks
330
+ tf list -p 4 --json | \
331
+ jq -r '.[].id' | \
332
+ xargs -I {} tf defer {}
333
+ ```
@@ -0,0 +1,232 @@
1
+ # Dependencies
2
+
3
+ TrakFlow maintains a dependency graph to track relationships between tasks.
4
+
5
+ ## Dependency Types
6
+
7
+ | Type | Description | Use Case |
8
+ |------|-------------|----------|
9
+ | `blocks` | Hard dependency (default) | Task A must complete before Task B |
10
+ | `related` | Soft link | Reference between related tasks |
11
+ | `parent-child` | Hierarchical | Subtask relationship |
12
+ | `discovered-from` | Traceability | Track where a task originated |
13
+
14
+ ## Adding Dependencies
15
+
16
+ ### Basic Syntax
17
+
18
+ ```bash
19
+ tf dep add SOURCE TARGET [--type TYPE]
20
+ ```
21
+
22
+ The source task blocks/relates-to the target task.
23
+
24
+ ### Examples
25
+
26
+ ```bash
27
+ # Design must complete before implementation
28
+ tf dep add tf-design tf-implement
29
+
30
+ # Specify dependency type
31
+ tf dep add tf-design tf-implement --type blocks
32
+ tf dep add tf-bug1 tf-bug2 -t related
33
+ ```
34
+
35
+ ## Removing Dependencies
36
+
37
+ ```bash
38
+ tf dep remove SOURCE TARGET
39
+ ```
40
+
41
+ ## Viewing Dependencies
42
+
43
+ ### Dependency Tree
44
+
45
+ ```bash
46
+ tf dep tree tf-implement
47
+ ```
48
+
49
+ Output:
50
+
51
+ ```
52
+ tf-implement
53
+ ├── blocked by:
54
+ │ └── tf-design (open)
55
+ └── blocks:
56
+ ├── tf-test (open)
57
+ └── tf-deploy (open)
58
+ ```
59
+
60
+ ### Dependency Graph
61
+
62
+ Generate a visual graph:
63
+
64
+ ```bash
65
+ tf admin graph
66
+ tf admin graph --format svg --output deps.svg
67
+ ```
68
+
69
+ ## Ready Work Detection
70
+
71
+ Find tasks with no open blockers:
72
+
73
+ ```bash
74
+ tf ready
75
+ ```
76
+
77
+ A task is "ready" when:
78
+ - Status is `open`
79
+ - All blocking dependencies are `closed`
80
+ - Not a Plan (Plans can't be executed directly)
81
+
82
+ ### How It Works
83
+
84
+ ```mermaid
85
+ graph LR
86
+ A[Design ✓] -->|blocks| B[Implement]
87
+ B -->|blocks| C[Test]
88
+ B -->|blocks| D[Docs]
89
+
90
+ style A fill:#90EE90
91
+ style B fill:#90EE90
92
+ style C fill:#FFE4B5
93
+ style D fill:#FFE4B5
94
+ ```
95
+
96
+ In this example:
97
+ - Design is closed (✓)
98
+ - Implement is **ready** (no open blockers)
99
+ - Test and Docs are NOT ready (blocked by Implement)
100
+
101
+ ## Common Patterns
102
+
103
+ ### Sequential Workflow
104
+
105
+ ```bash
106
+ tf create "Step 1: Research"
107
+ tf create "Step 2: Design"
108
+ tf create "Step 3: Implement"
109
+ tf create "Step 4: Test"
110
+
111
+ tf dep add tf-step1 tf-step2
112
+ tf dep add tf-step2 tf-step3
113
+ tf dep add tf-step3 tf-step4
114
+ ```
115
+
116
+ ```mermaid
117
+ graph LR
118
+ A[Research] --> B[Design] --> C[Implement] --> D[Test]
119
+ ```
120
+
121
+ ### Parallel Tasks with Sync Point
122
+
123
+ ```bash
124
+ tf create "Frontend work"
125
+ tf create "Backend work"
126
+ tf create "Integration"
127
+
128
+ tf dep add tf-frontend tf-integration
129
+ tf dep add tf-backend tf-integration
130
+ ```
131
+
132
+ ```mermaid
133
+ graph LR
134
+ A[Frontend] --> C[Integration]
135
+ B[Backend] --> C
136
+ ```
137
+
138
+ ### Feature with Prerequisites
139
+
140
+ ```bash
141
+ tf create "Add payment support" -t feature
142
+ tf create "Set up Stripe account"
143
+ tf create "Get API keys"
144
+ tf create "Implement payment flow"
145
+
146
+ tf dep add tf-stripe tf-implement
147
+ tf dep add tf-keys tf-implement
148
+ ```
149
+
150
+ ```mermaid
151
+ graph LR
152
+ A[Stripe Account] --> C[Implement Payment]
153
+ B[Get API Keys] --> C
154
+ ```
155
+
156
+ ## Dependency Validation
157
+
158
+ TrakFlow validates dependencies:
159
+
160
+ | Rule | Error |
161
+ |------|-------|
162
+ | No self-reference | Can't add dependency to itself |
163
+ | Tasks must exist | Both source and target must exist |
164
+ | No cycles (optional) | Prevents circular dependencies |
165
+
166
+ ### Cycle Detection
167
+
168
+ ```bash
169
+ # This would create a cycle: A → B → C → A
170
+ tf dep add tf-c tf-a
171
+
172
+ # Warning: Creates circular dependency
173
+ ```
174
+
175
+ ## Querying Dependencies
176
+
177
+ ### Find Blocked Tasks
178
+
179
+ ```bash
180
+ tf list --status blocked
181
+ ```
182
+
183
+ ### Find Tasks Blocking Others
184
+
185
+ ```bash
186
+ # Show what a task blocks
187
+ tf dep tree tf-abc123
188
+ ```
189
+
190
+ ### Find Orphan Tasks
191
+
192
+ Tasks with no dependencies:
193
+
194
+ ```bash
195
+ tf admin analyze
196
+ ```
197
+
198
+ ## Impact on Operations
199
+
200
+ ### Closing Tasks
201
+
202
+ When you close a task, dependent tasks may become ready:
203
+
204
+ ```bash
205
+ tf close tf-design
206
+ # tf-implement is now ready (if it was only blocked by tf-design)
207
+ ```
208
+
209
+ ### Reopening Tasks
210
+
211
+ Reopening a task re-blocks its dependents:
212
+
213
+ ```bash
214
+ tf reopen tf-design
215
+ # tf-implement is blocked again
216
+ ```
217
+
218
+ ## Best Practices
219
+
220
+ ### Dependency Guidelines
221
+
222
+ 1. **Keep graphs simple** - Avoid overly complex dependency chains
223
+ 2. **Use meaningful types** - Choose the right dependency type
224
+ 3. **Document relationships** - Add notes explaining why dependencies exist
225
+ 4. **Review regularly** - Clean up stale dependencies
226
+
227
+ ### Avoiding Issues
228
+
229
+ 1. **Check for cycles** - Before adding dependencies
230
+ 2. **Don't over-connect** - Not everything needs to be linked
231
+ 3. **Use labels for grouping** - Instead of `related` dependencies
232
+ 4. **Keep chains short** - Long chains slow progress