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.
- checksums.yaml +7 -0
- data/.envrc +3 -0
- data/CHANGELOG.md +69 -0
- data/COMMITS.md +196 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +281 -0
- data/README.md +479 -0
- data/Rakefile +16 -0
- data/bin/tf +6 -0
- data/bin/tf_mcp +81 -0
- data/docs/.keep +0 -0
- data/docs/api/database.md +434 -0
- data/docs/api/ruby-library.md +349 -0
- data/docs/api/task-model.md +341 -0
- data/docs/assets/stylesheets/extra.css +53 -0
- data/docs/assets/trak_flow.jpg +0 -0
- data/docs/cli/admin-commands.md +369 -0
- data/docs/cli/dependency-commands.md +321 -0
- data/docs/cli/label-commands.md +222 -0
- data/docs/cli/overview.md +163 -0
- data/docs/cli/plan-commands.md +344 -0
- data/docs/cli/task-commands.md +333 -0
- data/docs/core-concepts/dependencies.md +232 -0
- data/docs/core-concepts/labels.md +217 -0
- data/docs/core-concepts/overview.md +178 -0
- data/docs/core-concepts/plans-workflows.md +264 -0
- data/docs/core-concepts/tasks.md +205 -0
- data/docs/getting-started/configuration.md +120 -0
- data/docs/getting-started/installation.md +79 -0
- data/docs/getting-started/quick-start.md +245 -0
- data/docs/index.md +169 -0
- data/docs/mcp/integration.md +302 -0
- data/docs/mcp/overview.md +206 -0
- data/docs/mcp/resources.md +284 -0
- data/docs/mcp/tools.md +457 -0
- data/examples/basic_usage.rb +365 -0
- data/examples/cli_demo.sh +314 -0
- data/examples/mcp/Gemfile +9 -0
- data/examples/mcp/Gemfile.lock +226 -0
- data/examples/mcp/http_demo.rb +232 -0
- data/examples/mcp/stdio_demo.rb +146 -0
- data/lib/trak_flow/cli/admin_commands.rb +136 -0
- data/lib/trak_flow/cli/config_commands.rb +260 -0
- data/lib/trak_flow/cli/dep_commands.rb +71 -0
- data/lib/trak_flow/cli/label_commands.rb +76 -0
- data/lib/trak_flow/cli/main_commands.rb +386 -0
- data/lib/trak_flow/cli/plan_commands.rb +185 -0
- data/lib/trak_flow/cli/workflow_commands.rb +133 -0
- data/lib/trak_flow/cli.rb +110 -0
- data/lib/trak_flow/config/defaults.yml +114 -0
- data/lib/trak_flow/config/section.rb +74 -0
- data/lib/trak_flow/config.rb +276 -0
- data/lib/trak_flow/graph/dependency_graph.rb +288 -0
- data/lib/trak_flow/id_generator.rb +52 -0
- data/lib/trak_flow/mcp/resources/base_resource.rb +25 -0
- data/lib/trak_flow/mcp/resources/dependency_graph.rb +31 -0
- data/lib/trak_flow/mcp/resources/label_list.rb +21 -0
- data/lib/trak_flow/mcp/resources/plan_by_id.rb +27 -0
- data/lib/trak_flow/mcp/resources/plan_list.rb +21 -0
- data/lib/trak_flow/mcp/resources/task_by_id.rb +31 -0
- data/lib/trak_flow/mcp/resources/task_list.rb +21 -0
- data/lib/trak_flow/mcp/resources/task_next.rb +30 -0
- data/lib/trak_flow/mcp/resources/workflow_by_id.rb +27 -0
- data/lib/trak_flow/mcp/resources/workflow_list.rb +21 -0
- data/lib/trak_flow/mcp/server.rb +140 -0
- data/lib/trak_flow/mcp/tools/base_tool.rb +29 -0
- data/lib/trak_flow/mcp/tools/comment_add.rb +33 -0
- data/lib/trak_flow/mcp/tools/dep_add.rb +34 -0
- data/lib/trak_flow/mcp/tools/dep_remove.rb +25 -0
- data/lib/trak_flow/mcp/tools/label_add.rb +28 -0
- data/lib/trak_flow/mcp/tools/label_remove.rb +25 -0
- data/lib/trak_flow/mcp/tools/plan_add_step.rb +35 -0
- data/lib/trak_flow/mcp/tools/plan_create.rb +33 -0
- data/lib/trak_flow/mcp/tools/plan_run.rb +58 -0
- data/lib/trak_flow/mcp/tools/plan_start.rb +58 -0
- data/lib/trak_flow/mcp/tools/task_block.rb +27 -0
- data/lib/trak_flow/mcp/tools/task_close.rb +26 -0
- data/lib/trak_flow/mcp/tools/task_create.rb +51 -0
- data/lib/trak_flow/mcp/tools/task_defer.rb +27 -0
- data/lib/trak_flow/mcp/tools/task_start.rb +25 -0
- data/lib/trak_flow/mcp/tools/task_update.rb +36 -0
- data/lib/trak_flow/mcp/tools/workflow_discard.rb +28 -0
- data/lib/trak_flow/mcp/tools/workflow_summarize.rb +34 -0
- data/lib/trak_flow/mcp.rb +38 -0
- data/lib/trak_flow/models/comment.rb +71 -0
- data/lib/trak_flow/models/dependency.rb +96 -0
- data/lib/trak_flow/models/label.rb +90 -0
- data/lib/trak_flow/models/task.rb +188 -0
- data/lib/trak_flow/storage/database.rb +638 -0
- data/lib/trak_flow/storage/jsonl.rb +259 -0
- data/lib/trak_flow/time_parser.rb +15 -0
- data/lib/trak_flow/version.rb +5 -0
- data/lib/trak_flow.rb +100 -0
- data/mkdocs.yml +143 -0
- metadata +392 -0
data/README.md
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
# TrakFlow
|
|
2
|
+
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
<td width="40%">
|
|
6
|
+
<img src="docs/assets/trak_flow.jpg" alt="TrakFlow" width="100%">
|
|
7
|
+
</td>
|
|
8
|
+
<td width="60%" valign="top">
|
|
9
|
+
<strong>A distributed task tracking system for Robots with a DAG-based workflow engine.</strong>
|
|
10
|
+
<br><br>
|
|
11
|
+
TrakFlow helps Robots (what some might call AI agents) manage complex, multi-step work pipelines without losing track of what they need to do. It uses a dependency-aware task graph to codify plans and workflows, enabling Robots to handle lengthy operations reliably. Tasks are stored as git-tracked JSONL files with a SQLite cache for fast queries. The MCP server exposes your tasks to any Model Context Protocol compatible application.
|
|
12
|
+
<br><br>
|
|
13
|
+
<table>
|
|
14
|
+
<tr>
|
|
15
|
+
<td>:file_folder: Git-Backed</td>
|
|
16
|
+
<td>:zap: SQLite Cache</td>
|
|
17
|
+
</tr>
|
|
18
|
+
<tr>
|
|
19
|
+
<td>:id: Hash-Based IDs</td>
|
|
20
|
+
<td>:link: Dependency Graph</td>
|
|
21
|
+
</tr>
|
|
22
|
+
<tr>
|
|
23
|
+
<td>:robot: MCP Server</td>
|
|
24
|
+
<td>:arrows_counterclockwise: Plans & Workflows</td>
|
|
25
|
+
</tr>
|
|
26
|
+
</table>
|
|
27
|
+
</td>
|
|
28
|
+
</tr>
|
|
29
|
+
</table>
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<a href="https://madbomber.github.io/trak_flow/getting-started/installation/">Install</a> •
|
|
33
|
+
<a href="https://madbomber.github.io/trak_flow/getting-started/quick-start/">Quick Start</a> •
|
|
34
|
+
<a href="https://madbomber.github.io/trak_flow/">Documentation</a> •
|
|
35
|
+
<a href="#examples">Examples</a>
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<em>Under active development - watch out for frequent changes.</em>
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
### Git-Backed Persistence
|
|
47
|
+
|
|
48
|
+
Tasks are stored as human-readable JSONL files that live alongside your code. No external database server required. Every change is versioned through Git, giving you full history, branching, and collaboration capabilities. Roll back mistakes, review task history in PRs, and keep your project management data where it belongs—in your repository. The JSONL format is simple enough to edit by hand if needed, and plays nicely with standard Unix tools like `grep`, `jq`, and `awk`.
|
|
49
|
+
|
|
50
|
+
### Hash-Based IDs
|
|
51
|
+
|
|
52
|
+
TrakFlow generates unique task IDs using content hashing, eliminating merge conflicts when multiple Robots or team members create tasks simultaneously. No central ID server needed. IDs are deterministic and portable, making it safe to work offline and sync later without coordination overhead. Multiple Robots can work on the same project in parallel branches and merge their work cleanly.
|
|
53
|
+
|
|
54
|
+
### SQLite Cache
|
|
55
|
+
|
|
56
|
+
While JSONL provides persistence, a local SQLite database delivers blazing-fast queries with millisecond response times. Full-text search across task titles and descriptions, indexed lookups by status, priority, labels, and dependencies—all optimized for the rapid-fire queries that Robots generate during complex reasoning chains. The cache rebuilds automatically from JSONL on each session, so you never have to worry about sync issues.
|
|
57
|
+
|
|
58
|
+
### Dependency Graph
|
|
59
|
+
|
|
60
|
+
Model complex task relationships with a directed acyclic graph (DAG). Define blocking dependencies between tasks, mark related tasks for reference, and create parent-child hierarchies for organizing epics and subtasks. TrakFlow automatically detects cycles before they're created, identifies tasks that are ready for work (no open blockers), and can visualize your entire workflow as a graph. Perfect for multi-step pipelines where execution order matters.
|
|
61
|
+
|
|
62
|
+
### MCP Server
|
|
63
|
+
|
|
64
|
+
Expose your task data to Robots through the Model Context Protocol (MCP) standard. Compatible with Claude Desktop, VS Code extensions, and any MCP-enabled application. The server supports both STDIO transport for local development and IDE integrations, and HTTP/SSE transport for remote access and multi-client scenarios. Robots can create tasks, query by any field, update status, manage dependencies, and traverse the task graph—all through a clean tool-based API.
|
|
65
|
+
|
|
66
|
+
### Plans & Workflows
|
|
67
|
+
|
|
68
|
+
Define reusable workflow blueprints (Plans) and instantiate them as running Workflows. Perfect for repeatable processes like deployments, code reviews, release checklists, or onboarding procedures. Each Plan contains a sequence of task templates that get copied into a new Workflow when started. Choose persistent Workflows for audit trails and historical records, or ephemeral Workflows for temporary operations that auto-clean after completion to reduce clutter.
|
|
69
|
+
|
|
70
|
+
## Examples
|
|
71
|
+
|
|
72
|
+
The [`examples/`](examples/) directory contains working demos:
|
|
73
|
+
|
|
74
|
+
| Example | Description |
|
|
75
|
+
|---------|-------------|
|
|
76
|
+
| [`basic_usage.rb`](examples/basic_usage.rb) | Ruby library usage - creating tasks, managing dependencies, and querying the database |
|
|
77
|
+
| [`mcp/stdio_demo.rb`](examples/mcp/stdio_demo.rb) | MCP server with STDIO transport for local development and IDE integrations |
|
|
78
|
+
| [`mcp/http_demo.rb`](examples/mcp/http_demo.rb) | MCP server with HTTP/SSE transport for remote access and web applications |
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
Add to your Gemfile:
|
|
83
|
+
|
|
84
|
+
```ruby
|
|
85
|
+
gem 'trak_flow'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Or install directly:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
gem install trak_flow
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Quick Start
|
|
95
|
+
### Using the CLI utility `tf`
|
|
96
|
+
#### Basic Commands
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Initialize TrakFlow in your project
|
|
100
|
+
tf init
|
|
101
|
+
|
|
102
|
+
# Displays config file with defaults which you can copy
|
|
103
|
+
tf config defaults > ~/.config/trak_flow/trak_flow.yml
|
|
104
|
+
# ... edit your configuration
|
|
105
|
+
tf config show # will show your configuration
|
|
106
|
+
|
|
107
|
+
# Create a task
|
|
108
|
+
tf create "Implement user authentication" -t feature -p 1
|
|
109
|
+
|
|
110
|
+
# Create a child task
|
|
111
|
+
tf create "Add login form" --parent tf-a1b2
|
|
112
|
+
|
|
113
|
+
# Add a dependency
|
|
114
|
+
tf dep add tf-c3d4 tf-a1b2 -t blocks
|
|
115
|
+
|
|
116
|
+
# Find ready work
|
|
117
|
+
tf ready
|
|
118
|
+
|
|
119
|
+
# Show dependency tree
|
|
120
|
+
tf dep tree tf-a1b2
|
|
121
|
+
|
|
122
|
+
# Close a task
|
|
123
|
+
tf close tf-a1b2 -r "Implemented in PR #123"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### Working with Plans and Workflows
|
|
127
|
+
|
|
128
|
+
Plans are reusable workflow blueprints. Workflows are running instances of Plans.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Create a Plan (workflow blueprint)
|
|
132
|
+
tf plan create "Deploy to Production"
|
|
133
|
+
|
|
134
|
+
# Add tasks to the Plan
|
|
135
|
+
tf plan add tf-plan1 "Run tests"
|
|
136
|
+
tf plan add tf-plan1 "Build artifacts"
|
|
137
|
+
tf plan add tf-plan1 "Deploy to staging"
|
|
138
|
+
tf plan add tf-plan1 "Deploy to production"
|
|
139
|
+
|
|
140
|
+
# Start a persistent Workflow from the Plan
|
|
141
|
+
tf plan start tf-plan1
|
|
142
|
+
|
|
143
|
+
# Or execute an ephemeral Workflow (auto-cleaned after completion)
|
|
144
|
+
tf plan execute tf-plan1
|
|
145
|
+
|
|
146
|
+
# List all Workflows
|
|
147
|
+
tf workflow list
|
|
148
|
+
|
|
149
|
+
# Discard an ephemeral Workflow
|
|
150
|
+
tf workflow discard tf-wf1
|
|
151
|
+
|
|
152
|
+
# Summarize and close a Workflow
|
|
153
|
+
tf workflow summarize tf-wf1 -s "Deployed v2.1.0 successfully"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## CLI Reference
|
|
157
|
+
|
|
158
|
+
### Core Commands
|
|
159
|
+
|
|
160
|
+
| Command | Description |
|
|
161
|
+
|---------|-------------|
|
|
162
|
+
| `tf init` | Initialize TrakFlow in the current directory |
|
|
163
|
+
| `tf info` | Show database and configuration info |
|
|
164
|
+
| `tf create TITLE` | Create a new task |
|
|
165
|
+
| `tf show ID` | Show task details |
|
|
166
|
+
| `tf list` | List tasks with filters |
|
|
167
|
+
| `tf update ID` | Update a task |
|
|
168
|
+
| `tf close ID` | Close a task |
|
|
169
|
+
| `tf reopen ID` | Reopen a closed task |
|
|
170
|
+
| `tf ready` | Show tasks ready for work |
|
|
171
|
+
| `tf stale` | Show stale tasks |
|
|
172
|
+
| `tf sync` | Sync database with JSONL file |
|
|
173
|
+
|
|
174
|
+
The `create` command supports additional flags:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
tf create TITLE [options]
|
|
178
|
+
-t, --type TYPE # Task type (bug, feature, task, epic, chore)
|
|
179
|
+
-p, --priority NUM # Priority (0=critical, 4=backlog)
|
|
180
|
+
-d, --description TEXT # Task description
|
|
181
|
+
-a, --assignee NAME # Assignee
|
|
182
|
+
--parent ID # Create as child of another task
|
|
183
|
+
--plan # Create as a Plan (workflow blueprint)
|
|
184
|
+
--ephemeral # Create as ephemeral (one-shot)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Task Types
|
|
188
|
+
|
|
189
|
+
- `bug` - Bug fixes
|
|
190
|
+
- `feature` - New features
|
|
191
|
+
- `task` - General tasks
|
|
192
|
+
- `epic` - Parent task containing sub-tasks
|
|
193
|
+
- `chore` - Maintenance tasks
|
|
194
|
+
|
|
195
|
+
### Priority Levels
|
|
196
|
+
|
|
197
|
+
- `0` - Critical
|
|
198
|
+
- `1` - High
|
|
199
|
+
- `2` - Medium (default)
|
|
200
|
+
- `3` - Low
|
|
201
|
+
- `4` - Backlog
|
|
202
|
+
|
|
203
|
+
### Statuses
|
|
204
|
+
|
|
205
|
+
- `open` - Ready to work
|
|
206
|
+
- `in_progress` - Currently being worked on
|
|
207
|
+
- `blocked` - Waiting on dependencies
|
|
208
|
+
- `deferred` - Postponed
|
|
209
|
+
- `closed` - Complete
|
|
210
|
+
- `tombstone` - Archived
|
|
211
|
+
- `pinned` - Pinned for visibility
|
|
212
|
+
|
|
213
|
+
### Dependency Commands
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
tf dep add SOURCE TARGET [-t TYPE] # Add dependency
|
|
217
|
+
tf dep remove SOURCE TARGET # Remove dependency
|
|
218
|
+
tf dep tree ID # Show dependency tree
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Dependency types:
|
|
222
|
+
- `blocks` - Hard dependency (default)
|
|
223
|
+
- `related` - Soft link
|
|
224
|
+
- `parent-child` - Hierarchical
|
|
225
|
+
- `discovered-from` - Traceability
|
|
226
|
+
|
|
227
|
+
### Label Commands
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
tf label add ID LABEL # Add label to task
|
|
231
|
+
tf label remove ID LABEL # Remove label
|
|
232
|
+
tf label list ID # List labels for task
|
|
233
|
+
tf label list-all # List all labels
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Plan Commands
|
|
237
|
+
|
|
238
|
+
Plans are workflow blueprints that can be instantiated as Workflows.
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
tf plan create TITLE # Create a new Plan
|
|
242
|
+
tf plan list # List all Plans
|
|
243
|
+
tf plan list -w # List all Workflows instead
|
|
244
|
+
tf plan show ID # Show Plan with its tasks
|
|
245
|
+
tf plan add PLAN_ID TITLE # Add a task to a Plan
|
|
246
|
+
tf plan start PLAN_ID # Create persistent Workflow from Plan
|
|
247
|
+
tf plan execute PLAN_ID # Create ephemeral Workflow from Plan
|
|
248
|
+
tf plan convert ID # Convert existing task to a Plan
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Workflow Commands
|
|
252
|
+
|
|
253
|
+
Workflows are running instances of Plans.
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
tf workflow list # List all Workflows
|
|
257
|
+
tf workflow list -e # List only ephemeral Workflows
|
|
258
|
+
tf workflow show ID # Show Workflow with its tasks
|
|
259
|
+
tf workflow discard ID # Discard ephemeral Workflow
|
|
260
|
+
tf workflow summarize ID # Summarize and close Workflow
|
|
261
|
+
tf workflow gc # Garbage collect old ephemeral Workflows
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Config Commands
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
tf config # Show bundled default configuration
|
|
268
|
+
tf config show # Show current active configuration
|
|
269
|
+
tf config defaults # Show bundled default configuration
|
|
270
|
+
tf config reset # Reset configuration to defaults
|
|
271
|
+
tf config reset -g # Reset global (XDG) config
|
|
272
|
+
tf config reset -f # Force overwrite existing config
|
|
273
|
+
tf config get KEY # Get a config value (e.g., 'mcp.port')
|
|
274
|
+
tf config set KEY VALUE # Set a config value
|
|
275
|
+
tf config path # Show configuration file paths
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Configuration sources (lowest to highest priority):
|
|
279
|
+
1. Bundled defaults (ships with gem)
|
|
280
|
+
2. XDG user config (`~/.config/trak_flow/trak_flow.yml`)
|
|
281
|
+
3. Project config (`.trak_flow/config.yml`)
|
|
282
|
+
4. Environment variables (`TF_*`)
|
|
283
|
+
|
|
284
|
+
### Admin Commands
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
tf admin cleanup # Clean up old closed tasks
|
|
288
|
+
tf admin compact # Compact the database
|
|
289
|
+
tf admin graph # Generate dependency graph (DOT/SVG)
|
|
290
|
+
tf admin analyze # Analyze the task graph
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Configuration
|
|
294
|
+
|
|
295
|
+
TrakFlow uses the [anyway_config](https://github.com/palkan/anyway_config) gem for configuration management. Configuration is stored in YAML format.
|
|
296
|
+
|
|
297
|
+
### Configuration Files
|
|
298
|
+
|
|
299
|
+
| Priority | Location | Purpose |
|
|
300
|
+
|----------|----------|---------|
|
|
301
|
+
| 1 (lowest) | Bundled defaults | Ships with gem |
|
|
302
|
+
| 2 | `~/.config/trak_flow/trak_flow.yml` | User-wide settings |
|
|
303
|
+
| 3 | `.trak_flow/config.yml` | Project-specific settings |
|
|
304
|
+
| 4 (highest) | Environment variables | Runtime overrides |
|
|
305
|
+
|
|
306
|
+
### Example Configuration
|
|
307
|
+
|
|
308
|
+
```yaml
|
|
309
|
+
# ~/.config/trak_flow/trak_flow.yml
|
|
310
|
+
defaults:
|
|
311
|
+
output:
|
|
312
|
+
json: false
|
|
313
|
+
stealth: false
|
|
314
|
+
daemon:
|
|
315
|
+
disabled: false
|
|
316
|
+
auto_start: true
|
|
317
|
+
flush_debounce: 5
|
|
318
|
+
sync:
|
|
319
|
+
auto_flush: true
|
|
320
|
+
auto_import: true
|
|
321
|
+
push: true
|
|
322
|
+
create:
|
|
323
|
+
require_description: false
|
|
324
|
+
storage:
|
|
325
|
+
jsonl_file: tasks.jsonl
|
|
326
|
+
database:
|
|
327
|
+
path: ~/.config/trak_flow/tf.db
|
|
328
|
+
mcp:
|
|
329
|
+
port: 3333
|
|
330
|
+
actor: robot
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Environment Variables
|
|
334
|
+
|
|
335
|
+
Environment variables use the `TF_` prefix and double underscores for nested keys:
|
|
336
|
+
|
|
337
|
+
| Variable | Configuration Key | Example |
|
|
338
|
+
|----------|-------------------|---------|
|
|
339
|
+
| `TF_ACTOR` | `actor` | `TF_ACTOR=robot` |
|
|
340
|
+
| `TF_OUTPUT__JSON` | `output.json` | `TF_OUTPUT__JSON=true` |
|
|
341
|
+
| `TF_OUTPUT__STEALTH` | `output.stealth` | `TF_OUTPUT__STEALTH=true` |
|
|
342
|
+
| `TF_DAEMON__DISABLED` | `daemon.disabled` | `TF_DAEMON__DISABLED=true` |
|
|
343
|
+
| `TF_DAEMON__AUTO_START` | `daemon.auto_start` | `TF_DAEMON__AUTO_START=false` |
|
|
344
|
+
| `TF_SYNC__AUTO_FLUSH` | `sync.auto_flush` | `TF_SYNC__AUTO_FLUSH=false` |
|
|
345
|
+
| `TF_SYNC__PUSH` | `sync.push` | `TF_SYNC__PUSH=false` |
|
|
346
|
+
| `TF_STORAGE__JSONL_FILE` | `storage.jsonl_file` | `TF_STORAGE__JSONL_FILE=issues.jsonl` |
|
|
347
|
+
| `TF_DATABASE__PATH` | `database.path` | `TF_DATABASE__PATH=/tmp/tf.db` |
|
|
348
|
+
| `TF_MCP__PORT` | `mcp.port` | `TF_MCP__PORT=4000` |
|
|
349
|
+
|
|
350
|
+
## MCP Server
|
|
351
|
+
|
|
352
|
+
TrakFlow includes a Model Context Protocol (MCP) server that exposes task management to AI agents. Compatible with Claude Desktop, VS Code extensions, and any MCP-enabled application.
|
|
353
|
+
|
|
354
|
+
### Starting the Server
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
# STDIO transport (for local development and IDE integrations)
|
|
358
|
+
tf_mcp
|
|
359
|
+
|
|
360
|
+
# HTTP/SSE transport (for remote access and web applications)
|
|
361
|
+
tf_mcp --http --port 3333
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Available Tools
|
|
365
|
+
|
|
366
|
+
| Tool | Description |
|
|
367
|
+
|------|-------------|
|
|
368
|
+
| `task_create` | Create a new task |
|
|
369
|
+
| `task_list` | List tasks with filters |
|
|
370
|
+
| `task_show` | Get task details |
|
|
371
|
+
| `task_update` | Update task properties |
|
|
372
|
+
| `task_start` | Mark task as in progress |
|
|
373
|
+
| `task_close` | Complete a task |
|
|
374
|
+
| `task_block` | Mark task as blocked |
|
|
375
|
+
| `task_reopen` | Reopen a closed task |
|
|
376
|
+
| `plan_create` | Create a Plan blueprint |
|
|
377
|
+
| `plan_add_step` | Add a step to a Plan |
|
|
378
|
+
| `plan_start` | Create persistent Workflow from Plan |
|
|
379
|
+
| `plan_execute` | Create ephemeral Workflow from Plan |
|
|
380
|
+
| `dep_add` | Add dependency between tasks |
|
|
381
|
+
| `dep_remove` | Remove a dependency |
|
|
382
|
+
| `ready_tasks` | Find tasks with no blockers |
|
|
383
|
+
| `label_add` | Add label to a task |
|
|
384
|
+
| `label_remove` | Remove label from a task |
|
|
385
|
+
| `label_list` | List labels on a task |
|
|
386
|
+
|
|
387
|
+
### Available Resources
|
|
388
|
+
|
|
389
|
+
| URI | Description |
|
|
390
|
+
|-----|-------------|
|
|
391
|
+
| `trak_flow://tasks` | All tasks in the project |
|
|
392
|
+
| `trak_flow://ready` | Tasks ready to work on (no blockers) |
|
|
393
|
+
| `trak_flow://dependencies` | Dependency graph between tasks |
|
|
394
|
+
| `trak_flow://plans` | Plan blueprints and their Workflows |
|
|
395
|
+
| `trak_flow://labels` | All labels used in the project |
|
|
396
|
+
| `trak_flow://summary` | Project status overview |
|
|
397
|
+
|
|
398
|
+
### Claude Desktop Integration
|
|
399
|
+
|
|
400
|
+
Add to your Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
401
|
+
|
|
402
|
+
```json
|
|
403
|
+
{
|
|
404
|
+
"mcpServers": {
|
|
405
|
+
"trak_flow": {
|
|
406
|
+
"command": "tf_mcp",
|
|
407
|
+
"args": []
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## Architecture
|
|
414
|
+
|
|
415
|
+
```
|
|
416
|
+
.trak_flow/
|
|
417
|
+
├── trak_flow.db # SQLite database (gitignored)
|
|
418
|
+
├── tasks.jsonl # Git-tracked source of truth
|
|
419
|
+
├── config.yml # Project configuration (YAML)
|
|
420
|
+
└── .gitignore
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
The system uses a three-layer architecture:
|
|
424
|
+
|
|
425
|
+
1. **CLI Commands** - User-facing Thor commands
|
|
426
|
+
2. **SQLite Database** - Fast local queries
|
|
427
|
+
3. **JSONL Format** - Git-tracked persistence
|
|
428
|
+
|
|
429
|
+
## Conceptual Model
|
|
430
|
+
|
|
431
|
+
TrakFlow uses a single `Task` model that serves multiple roles based on flags:
|
|
432
|
+
|
|
433
|
+
| Role | Identification | Description |
|
|
434
|
+
|------|----------------|-------------|
|
|
435
|
+
| **Plan** | `task.plan? == true` | Workflow blueprint (never executed directly) |
|
|
436
|
+
| **Step** | Child of a Plan | Task within a Plan definition |
|
|
437
|
+
| **Workflow** | `task.source_plan_id` set | Running instance of a Plan |
|
|
438
|
+
| **Work Item** | Child of a Workflow | Task within a running Workflow |
|
|
439
|
+
|
|
440
|
+
### Task Lifecycle
|
|
441
|
+
|
|
442
|
+
```
|
|
443
|
+
Plan (blueprint)
|
|
444
|
+
└── Tasks (step definitions)
|
|
445
|
+
│
|
|
446
|
+
├── start → Persistent Workflow (keeps history)
|
|
447
|
+
└── execute → Ephemeral Workflow (garbage collectible)
|
|
448
|
+
│
|
|
449
|
+
└── Tasks (work items)
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Ephemeral vs Persistent
|
|
453
|
+
|
|
454
|
+
| Type | Lifecycle | JSONL Export |
|
|
455
|
+
|------|-----------|--------------|
|
|
456
|
+
| **Persistent** | Kept forever | Exported |
|
|
457
|
+
| **Ephemeral** | Auto-cleaned after completion | Not exported |
|
|
458
|
+
|
|
459
|
+
Ephemeral workflows are useful for:
|
|
460
|
+
- One-shot operations that don't need permanent records
|
|
461
|
+
- Temporary exploratory work
|
|
462
|
+
- Reducing clutter in the task history
|
|
463
|
+
|
|
464
|
+
## Development
|
|
465
|
+
|
|
466
|
+
```bash
|
|
467
|
+
# Install dependencies
|
|
468
|
+
bundle install
|
|
469
|
+
|
|
470
|
+
# Run tests
|
|
471
|
+
bundle exec rake test
|
|
472
|
+
|
|
473
|
+
# Run the CLI locally
|
|
474
|
+
bundle exec bin/tf
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## License
|
|
478
|
+
|
|
479
|
+
MIT
|
data/Rakefile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rake/testtask"
|
|
5
|
+
require "rubocop/rake_task"
|
|
6
|
+
|
|
7
|
+
Rake::TestTask.new(:test) do |t|
|
|
8
|
+
t.libs << "test"
|
|
9
|
+
t.libs << "lib"
|
|
10
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
|
11
|
+
t.warning = false
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
RuboCop::RakeTask.new
|
|
15
|
+
|
|
16
|
+
task default: %i[test rubocop]
|
data/bin/tf
ADDED
data/bin/tf_mcp
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "bundler/setup"
|
|
5
|
+
|
|
6
|
+
# TrakFlow MCP Server
|
|
7
|
+
# Provides Model Context Protocol interface for TrakFlow task management
|
|
8
|
+
#
|
|
9
|
+
# Usage:
|
|
10
|
+
# tf_mcp # Start stdio server (default)
|
|
11
|
+
# tf_mcp --stdio # Start stdio server
|
|
12
|
+
# tf_mcp --http # Start HTTP server on port 3333
|
|
13
|
+
# tf_mcp --http 8080 # Start HTTP server on port 8080
|
|
14
|
+
# tf_mcp --both # Start both stdio and HTTP on port 3333
|
|
15
|
+
# tf_mcp --both 8080 # Start both stdio and HTTP on port 8080
|
|
16
|
+
# tf_mcp --help # Show help
|
|
17
|
+
|
|
18
|
+
require_relative "../lib/trak_flow"
|
|
19
|
+
require_relative "../lib/trak_flow/mcp"
|
|
20
|
+
|
|
21
|
+
def parse_port(args)
|
|
22
|
+
port_index = args.index { |a| a.match?(/^\d+$/) }
|
|
23
|
+
port_index ? args[port_index].to_i : nil
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def default_port
|
|
27
|
+
TrakFlow.config.mcp.port
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def print_help
|
|
31
|
+
puts <<~HELP
|
|
32
|
+
TrakFlow MCP Server v#{TrakFlow::VERSION}
|
|
33
|
+
|
|
34
|
+
Usage: tf_mcp [OPTIONS]
|
|
35
|
+
|
|
36
|
+
Options:
|
|
37
|
+
--stdio Run as stdio server (default)
|
|
38
|
+
--http [PORT] Run as HTTP server (default port: #{default_port})
|
|
39
|
+
--both [PORT] Run both stdio and HTTP simultaneously
|
|
40
|
+
--help, -h Show this help message
|
|
41
|
+
|
|
42
|
+
Examples:
|
|
43
|
+
tf_mcp # Start stdio server
|
|
44
|
+
tf_mcp --http # Start HTTP server on port #{default_port}
|
|
45
|
+
tf_mcp --http 8080 # Start HTTP server on port 8080
|
|
46
|
+
tf_mcp --both # Start both transports
|
|
47
|
+
|
|
48
|
+
Configuration:
|
|
49
|
+
Default port is configured in TrakFlow config (mcp.port: #{default_port})
|
|
50
|
+
|
|
51
|
+
For Claude Code / Claude Desktop (stdio):
|
|
52
|
+
Add to your MCP settings:
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"trak_flow": {
|
|
56
|
+
"command": "tf_mcp"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
For HTTP clients:
|
|
62
|
+
Connect to: http://localhost:PORT/mcp/sse
|
|
63
|
+
HELP
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
if ARGV.include?("--help") || ARGV.include?("-h")
|
|
67
|
+
print_help
|
|
68
|
+
exit 0
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
server = TrakFlow::Mcp::Server.new
|
|
72
|
+
|
|
73
|
+
if ARGV.include?("--both")
|
|
74
|
+
port = parse_port(ARGV)
|
|
75
|
+
server.start_both(http_port: port)
|
|
76
|
+
elsif ARGV.include?("--http")
|
|
77
|
+
port = parse_port(ARGV)
|
|
78
|
+
server.start_http(port: port)
|
|
79
|
+
else
|
|
80
|
+
server.start_stdio
|
|
81
|
+
end
|
data/docs/.keep
ADDED
|
File without changes
|