@jaguilar87/gaia-ops 1.0.0
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.
- package/CHANGELOG.md +315 -0
- package/CLAUDE.md +154 -0
- package/LICENSE +21 -0
- package/README.md +221 -0
- package/agents/aws-troubleshooter.md +50 -0
- package/agents/claude-architect.md +821 -0
- package/agents/devops-developer.md +92 -0
- package/agents/gcp-troubleshooter.md +50 -0
- package/agents/gitops-operator.md +360 -0
- package/agents/terraform-architect.md +289 -0
- package/bin/gaia-init.js +620 -0
- package/commands/architect.md +97 -0
- package/commands/restore-session.md +87 -0
- package/commands/save-session.md +88 -0
- package/commands/session-status.md +61 -0
- package/commands/speckit.add-task.md +144 -0
- package/commands/speckit.analyze-task.md +65 -0
- package/commands/speckit.implement.md +96 -0
- package/commands/speckit.init.md +237 -0
- package/commands/speckit.plan.md +88 -0
- package/commands/speckit.specify.md +161 -0
- package/commands/speckit.tasks.md +188 -0
- package/config/AGENTS.md +162 -0
- package/config/agent-catalog.md +604 -0
- package/config/context-contracts.md +682 -0
- package/config/git-standards.md +674 -0
- package/config/git_standards.json +69 -0
- package/config/orchestration-workflow.md +735 -0
- package/hooks/__pycache__/post_tool_use.cpython-312.pyc +0 -0
- package/hooks/__pycache__/pre_kubectl_security.cpython-312.pyc +0 -0
- package/hooks/__pycache__/pre_tool_use.cpython-312.pyc +0 -0
- package/hooks/__pycache__/session_start.cpython-312.pyc +0 -0
- package/hooks/__pycache__/subagent_stop.cpython-312.pyc +0 -0
- package/hooks/post_tool_use.py +463 -0
- package/hooks/pre_kubectl_security.py +205 -0
- package/hooks/pre_tool_use.py +530 -0
- package/hooks/session_start.py +315 -0
- package/hooks/subagent_stop.py +549 -0
- package/index.js +92 -0
- package/package.json +59 -0
- package/speckit/README.en.md +648 -0
- package/speckit/README.md +353 -0
- package/speckit/governance.md +169 -0
- package/speckit/scripts/check-prerequisites.sh +194 -0
- package/speckit/scripts/common.sh +126 -0
- package/speckit/scripts/create-new-feature.sh +131 -0
- package/speckit/scripts/init.sh +42 -0
- package/speckit/scripts/setup-plan.sh +95 -0
- package/speckit/scripts/update-agent-context.sh +718 -0
- package/speckit/templates/adr-template.md +118 -0
- package/speckit/templates/agent-file-template.md +23 -0
- package/speckit/templates/plan-template.md +233 -0
- package/speckit/templates/spec-template.md +116 -0
- package/speckit/templates/tasks-template-bkp.md +136 -0
- package/speckit/templates/tasks-template.md +345 -0
- package/templates/CLAUDE.template.md +170 -0
- package/templates/code-examples/approval_gate_workflow.py +141 -0
- package/templates/code-examples/clarification_workflow.py +94 -0
- package/templates/code-examples/commit_validation.py +86 -0
- package/templates/project-context.template.json +126 -0
- package/templates/settings.template.json +307 -0
- package/tools/__pycache__/agent_router.cpython-312.pyc +0 -0
- package/tools/__pycache__/approval_gate.cpython-312.pyc +0 -0
- package/tools/__pycache__/clarify_engine.cpython-312.pyc +0 -0
- package/tools/__pycache__/clarify_patterns.cpython-312.pyc +0 -0
- package/tools/__pycache__/commit_validator.cpython-312.pyc +0 -0
- package/tools/__pycache__/context_section_reader.cpython-312.pyc +0 -0
- package/tools/__pycache__/routing_dashboard.cpython-312.pyc +0 -0
- package/tools/__pycache__/routing_feedback.cpython-312.pyc +0 -0
- package/tools/__pycache__/semantic_matcher.cpython-312.pyc +0 -0
- package/tools/__pycache__/task_manager.cpython-312.pyc +0 -0
- package/tools/agent_capabilities.json +231 -0
- package/tools/agent_invoker_helper.py +239 -0
- package/tools/agent_router.py +730 -0
- package/tools/approval_gate.py +318 -0
- package/tools/clarify_engine.py +511 -0
- package/tools/clarify_patterns.py +356 -0
- package/tools/commit_validator.py +338 -0
- package/tools/context_provider.py +181 -0
- package/tools/context_section_reader.py +301 -0
- package/tools/demo_clarify.py +104 -0
- package/tools/generate_embeddings.py +168 -0
- package/tools/quicktriage_aws_troubleshooter.sh +45 -0
- package/tools/quicktriage_devops_developer.sh +38 -0
- package/tools/quicktriage_gcp_troubleshooter.sh +51 -0
- package/tools/quicktriage_gitops_operator.sh +47 -0
- package/tools/quicktriage_terraform_architect.sh +40 -0
- package/tools/semantic_matcher.py +222 -0
- package/tools/task_manager.py +547 -0
- package/tools/task_manager_README.md +395 -0
- package/tools/task_manager_example.py +215 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
# TaskManager
|
|
2
|
+
|
|
3
|
+
Efficient task file operations for large projects without loading entire files.
|
|
4
|
+
|
|
5
|
+
## Problem Statement
|
|
6
|
+
|
|
7
|
+
Spec-Kit generates `tasks.md` files with rich metadata that can exceed **33,000 tokens**, causing Claude's Read tool to fail due to token limits. TaskManager solves this by using targeted Grep and Edit operations instead of loading entire files.
|
|
8
|
+
|
|
9
|
+
## Architecture
|
|
10
|
+
|
|
11
|
+
- **Grep-based Search**: Finds specific tasks without loading the full file
|
|
12
|
+
- **Targeted Editing**: Updates individual task checkboxes using sed
|
|
13
|
+
- **Metadata Parsing**: Extracts agent info, tags, security tiers from HTML comments
|
|
14
|
+
- **Large File Support**: Handles files >25,000 tokens efficiently
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
# TaskManager is located in .claude/tools/
|
|
20
|
+
# Import it in your agent or orchestrator code:
|
|
21
|
+
import sys
|
|
22
|
+
sys.path.insert(0, '/home/jaguilar/aaxis/rnd/repositories/.claude/tools')
|
|
23
|
+
from task_manager import TaskManager
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from task_manager import TaskManager
|
|
30
|
+
|
|
31
|
+
# Initialize with path to tasks.md
|
|
32
|
+
tm = TaskManager("/path/to/tasks.md")
|
|
33
|
+
|
|
34
|
+
# Get project statistics
|
|
35
|
+
stats = tm.get_task_statistics()
|
|
36
|
+
print(f"Project completion: {stats['completion_rate']}%")
|
|
37
|
+
|
|
38
|
+
# Get next pending tasks
|
|
39
|
+
pending = tm.get_pending_tasks(limit=5)
|
|
40
|
+
for task in pending:
|
|
41
|
+
print(f"{task['task_id']}: {task['title']}")
|
|
42
|
+
|
|
43
|
+
# Get full details for a specific task
|
|
44
|
+
details = tm.get_task_details("T045")
|
|
45
|
+
print(f"Agent: {details['metadata']['agent']}")
|
|
46
|
+
print(f"Security Tier: {details['metadata']['security_tier']}")
|
|
47
|
+
|
|
48
|
+
# Mark task as complete
|
|
49
|
+
if tm.mark_task_complete("T045"):
|
|
50
|
+
print("Task marked complete!")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## API Reference
|
|
54
|
+
|
|
55
|
+
### TaskManager(tasks_file_path: str)
|
|
56
|
+
|
|
57
|
+
Initialize TaskManager with path to tasks.md file.
|
|
58
|
+
|
|
59
|
+
**Args:**
|
|
60
|
+
- `tasks_file_path`: Absolute path to tasks.md file
|
|
61
|
+
|
|
62
|
+
**Raises:**
|
|
63
|
+
- `FileNotFoundError`: If tasks.md file doesn't exist
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### get_task_statistics() -> Dict[str, Any]
|
|
68
|
+
|
|
69
|
+
Get overall statistics for the tasks file.
|
|
70
|
+
|
|
71
|
+
**Returns:**
|
|
72
|
+
```python
|
|
73
|
+
{
|
|
74
|
+
'total_tasks': 50,
|
|
75
|
+
'pending_tasks': 12,
|
|
76
|
+
'completed_tasks': 38,
|
|
77
|
+
'completion_rate': 76.00
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
### get_pending_tasks(limit: int = 10) -> List[Dict[str, str]]
|
|
84
|
+
|
|
85
|
+
Get list of pending tasks using Grep.
|
|
86
|
+
|
|
87
|
+
**Args:**
|
|
88
|
+
- `limit`: Maximum number of tasks to return (default: 10)
|
|
89
|
+
|
|
90
|
+
**Returns:**
|
|
91
|
+
```python
|
|
92
|
+
[
|
|
93
|
+
{
|
|
94
|
+
'task_id': 'T045',
|
|
95
|
+
'title': 'Deploy query-api HelmRelease',
|
|
96
|
+
'line_number': 123
|
|
97
|
+
},
|
|
98
|
+
...
|
|
99
|
+
]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### get_task_details(task_id: str) -> Dict[str, Any]
|
|
105
|
+
|
|
106
|
+
Load full details for a specific task.
|
|
107
|
+
|
|
108
|
+
**Args:**
|
|
109
|
+
- `task_id`: Task identifier (e.g., "T045")
|
|
110
|
+
|
|
111
|
+
**Returns:**
|
|
112
|
+
```python
|
|
113
|
+
{
|
|
114
|
+
'task_id': 'T045',
|
|
115
|
+
'title': 'Deploy query-api HelmRelease',
|
|
116
|
+
'status': 'pending', # or 'completed'
|
|
117
|
+
'line_number': 123,
|
|
118
|
+
'metadata': {
|
|
119
|
+
'agent': 'gitops-operator',
|
|
120
|
+
'security_tier': 'T3',
|
|
121
|
+
'confidence': 0.95,
|
|
122
|
+
'tags': ['kubernetes', 'helm'],
|
|
123
|
+
'skill': {
|
|
124
|
+
'name': 'kubernetes_deployment',
|
|
125
|
+
'score': 10.0
|
|
126
|
+
},
|
|
127
|
+
'fallback': 'terraform-architect',
|
|
128
|
+
'result': 'HelmRelease deployed successfully'
|
|
129
|
+
},
|
|
130
|
+
'description': 'Create HelmRelease manifest...',
|
|
131
|
+
'acceptance_criteria': [
|
|
132
|
+
'Manifest created in correct directory',
|
|
133
|
+
'Values properly configured',
|
|
134
|
+
...
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Raises:**
|
|
140
|
+
- `ValueError`: If task_id not found or has invalid format
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### mark_task_complete(task_id: str) -> bool
|
|
145
|
+
|
|
146
|
+
Mark a task as complete using Grep to find + sed to update.
|
|
147
|
+
|
|
148
|
+
**Args:**
|
|
149
|
+
- `task_id`: Task identifier (e.g., "T045")
|
|
150
|
+
|
|
151
|
+
**Returns:**
|
|
152
|
+
- `True`: Task was marked complete
|
|
153
|
+
- `False`: Task was already complete
|
|
154
|
+
|
|
155
|
+
**Raises:**
|
|
156
|
+
- `ValueError`: If task_id not found or has invalid format
|
|
157
|
+
|
|
158
|
+
**Process:**
|
|
159
|
+
1. Use Grep to find line: `^- \[ \] {task_id}`
|
|
160
|
+
2. Verify task is pending (has `[ ]` checkbox)
|
|
161
|
+
3. Replace `- [ ]` with `- [x]` using sed
|
|
162
|
+
4. File is updated in place
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Task Format Recognition
|
|
167
|
+
|
|
168
|
+
TaskManager recognizes tasks in this format:
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
- [ ] T045 Deploy query-api HelmRelease
|
|
172
|
+
<!-- 🤖 Agent: gitops-operator | ✅ T3 | ⚡ 0.95 -->
|
|
173
|
+
<!-- 🏷️ Tags: #kubernetes #helm -->
|
|
174
|
+
<!-- 🎯 skill: kubernetes_deployment (10.0) -->
|
|
175
|
+
<!-- 🔄 Fallback: terraform-architect -->
|
|
176
|
+
|
|
177
|
+
**Description:** Create HelmRelease manifest...
|
|
178
|
+
|
|
179
|
+
**Acceptance Criteria:**
|
|
180
|
+
- Criterion 1
|
|
181
|
+
- Criterion 2
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Metadata Parsing
|
|
185
|
+
|
|
186
|
+
From HTML comments, TaskManager extracts:
|
|
187
|
+
|
|
188
|
+
- **Agent**: `gitops-operator`, `terraform-architect`, etc.
|
|
189
|
+
- **Security Tier**: `T0`, `T1`, `T2`, `T3`
|
|
190
|
+
- **Confidence**: Floating point score (0.0 - 1.0)
|
|
191
|
+
- **Tags**: List of tags (e.g., `kubernetes`, `helm`)
|
|
192
|
+
- **Skill**: Primary skill and match score
|
|
193
|
+
- **Fallback**: Alternative agent if primary fails
|
|
194
|
+
- **Result**: Completion notes (for completed tasks)
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Usage Examples
|
|
199
|
+
|
|
200
|
+
### Example 1: Orchestrator Workflow
|
|
201
|
+
|
|
202
|
+
```python
|
|
203
|
+
from task_manager import TaskManager
|
|
204
|
+
|
|
205
|
+
# Initialize
|
|
206
|
+
tm = TaskManager('/path/to/tasks.md')
|
|
207
|
+
|
|
208
|
+
# Get project status
|
|
209
|
+
stats = tm.get_task_statistics()
|
|
210
|
+
print(f"Project: {stats['completion_rate']}% complete")
|
|
211
|
+
print(f"Remaining: {stats['pending_tasks']} tasks")
|
|
212
|
+
|
|
213
|
+
# Get next pending tasks
|
|
214
|
+
pending = tm.get_pending_tasks(limit=5)
|
|
215
|
+
|
|
216
|
+
if pending:
|
|
217
|
+
# Get details for first task
|
|
218
|
+
task = tm.get_task_details(pending[0]['task_id'])
|
|
219
|
+
|
|
220
|
+
print(f"\nNext Task: {task['title']}")
|
|
221
|
+
print(f"Agent: {task['metadata']['agent']}")
|
|
222
|
+
print(f"Security Tier: {task['metadata']['security_tier']}")
|
|
223
|
+
|
|
224
|
+
# Execute task (your logic here)
|
|
225
|
+
# ...
|
|
226
|
+
|
|
227
|
+
# Mark complete
|
|
228
|
+
if tm.mark_task_complete(task['task_id']):
|
|
229
|
+
print(f"✅ Task {task['task_id']} completed!")
|
|
230
|
+
else:
|
|
231
|
+
print("✅ All tasks complete!")
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Example 2: Bulk Analysis
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
from task_manager import TaskManager
|
|
238
|
+
|
|
239
|
+
tm = TaskManager('/path/to/tasks.md')
|
|
240
|
+
|
|
241
|
+
# Get all pending tasks
|
|
242
|
+
pending = tm.get_pending_tasks(limit=100)
|
|
243
|
+
|
|
244
|
+
# Analyze by agent
|
|
245
|
+
agent_count = {}
|
|
246
|
+
for task in pending:
|
|
247
|
+
details = tm.get_task_details(task['task_id'])
|
|
248
|
+
agent = details['metadata'].get('agent', 'unassigned')
|
|
249
|
+
agent_count[agent] = agent_count.get(agent, 0) + 1
|
|
250
|
+
|
|
251
|
+
print("Tasks by Agent:")
|
|
252
|
+
for agent, count in sorted(agent_count.items()):
|
|
253
|
+
print(f" {agent}: {count} tasks")
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Example 3: Status Check
|
|
257
|
+
|
|
258
|
+
```python
|
|
259
|
+
from task_manager import TaskManager
|
|
260
|
+
|
|
261
|
+
tm = TaskManager('/path/to/tasks.md')
|
|
262
|
+
|
|
263
|
+
# Check specific tasks
|
|
264
|
+
task_ids = ['T001', 'T010', 'T020']
|
|
265
|
+
|
|
266
|
+
for task_id in task_ids:
|
|
267
|
+
try:
|
|
268
|
+
details = tm.get_task_details(task_id)
|
|
269
|
+
status = '✅' if details['status'] == 'completed' else '⏳'
|
|
270
|
+
print(f"{status} {task_id}: {details['status'].upper()}")
|
|
271
|
+
except ValueError:
|
|
272
|
+
print(f"❌ {task_id}: NOT FOUND")
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Error Handling
|
|
278
|
+
|
|
279
|
+
### Common Errors
|
|
280
|
+
|
|
281
|
+
**FileNotFoundError**
|
|
282
|
+
```python
|
|
283
|
+
try:
|
|
284
|
+
tm = TaskManager('/nonexistent/tasks.md')
|
|
285
|
+
except FileNotFoundError:
|
|
286
|
+
print("Tasks file not found")
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**ValueError - Task Not Found**
|
|
290
|
+
```python
|
|
291
|
+
try:
|
|
292
|
+
details = tm.get_task_details('T999999')
|
|
293
|
+
except ValueError as e:
|
|
294
|
+
print(f"Task not found: {e}")
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**ValueError - Invalid Format**
|
|
298
|
+
```python
|
|
299
|
+
try:
|
|
300
|
+
tm.mark_task_complete('INVALID_FORMAT')
|
|
301
|
+
except ValueError as e:
|
|
302
|
+
print(f"Invalid task ID: {e}")
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Task Already Complete**
|
|
306
|
+
```python
|
|
307
|
+
result = tm.mark_task_complete('T001')
|
|
308
|
+
if not result:
|
|
309
|
+
print("Task was already complete")
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Testing
|
|
315
|
+
|
|
316
|
+
Run the comprehensive test suite:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
cd /home/jaguilar/aaxis/rnd/repositories/.claude/tools
|
|
320
|
+
python3 task_manager.py /path/to/tasks.md
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Run usage examples:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
python3 task_manager_example.py
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Performance
|
|
332
|
+
|
|
333
|
+
### Efficiency Gains
|
|
334
|
+
|
|
335
|
+
| Operation | Traditional Read | TaskManager | Improvement |
|
|
336
|
+
|-----------|-----------------|-------------|-------------|
|
|
337
|
+
| Get pending tasks | Load 33K tokens | Grep search | **99% faster** |
|
|
338
|
+
| Get task details | Load 33K tokens | Grep + 25 lines | **98% faster** |
|
|
339
|
+
| Mark complete | Load + Edit + Write | sed in-place | **99% faster** |
|
|
340
|
+
|
|
341
|
+
### Token Usage
|
|
342
|
+
|
|
343
|
+
- **Traditional approach**: 33,000 tokens per operation
|
|
344
|
+
- **TaskManager**: ~100 tokens per operation
|
|
345
|
+
- **Savings**: 99.7% reduction in token usage
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Integration with Orchestrator
|
|
350
|
+
|
|
351
|
+
### CLAUDE.md Step 13 Integration
|
|
352
|
+
|
|
353
|
+
In the orchestrator's Phase 5 (Realization, Verification & Closure), use TaskManager to update the task plan:
|
|
354
|
+
|
|
355
|
+
```python
|
|
356
|
+
import sys
|
|
357
|
+
sys.path.insert(0, '/home/jaguilar/aaxis/rnd/repositories/.claude/tools')
|
|
358
|
+
from task_manager import TaskManager
|
|
359
|
+
|
|
360
|
+
# After successful verification
|
|
361
|
+
task_id = "T045" # The task that was just completed
|
|
362
|
+
|
|
363
|
+
# Update Plan SSOT
|
|
364
|
+
tm = TaskManager('/path/to/spec/tasks.md')
|
|
365
|
+
if tm.mark_task_complete(task_id):
|
|
366
|
+
print(f"✅ Task {task_id} marked complete in tasks.md")
|
|
367
|
+
else:
|
|
368
|
+
print(f"⚠️ Task {task_id} was already marked complete")
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## File Location
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
/home/jaguilar/aaxis/rnd/repositories/.claude/tools/
|
|
377
|
+
├── task_manager.py # Main implementation
|
|
378
|
+
├── task_manager_example.py # Usage examples
|
|
379
|
+
└── task_manager_README.md # This file
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Related Tools
|
|
385
|
+
|
|
386
|
+
- **approval_gate.py**: User approval workflow (Phase 4)
|
|
387
|
+
- **commit_validator.py**: Git commit message validation
|
|
388
|
+
- **context_provider.py**: Context payload generation for agents
|
|
389
|
+
- **agent_router.py**: Agent selection based on task requirements
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
## License
|
|
394
|
+
|
|
395
|
+
Internal tool for aaxis-rnd-general-project. Not for external distribution.
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"""
|
|
2
|
+
TaskManager Usage Examples
|
|
3
|
+
|
|
4
|
+
This file demonstrates practical usage patterns for TaskManager
|
|
5
|
+
in the context of the orchestrator workflow.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from task_manager import TaskManager
|
|
9
|
+
import sys
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def orchestrator_workflow_example():
|
|
13
|
+
"""
|
|
14
|
+
Example: Orchestrator workflow for task management
|
|
15
|
+
|
|
16
|
+
Shows how orchestrator would:
|
|
17
|
+
1. Get pending tasks
|
|
18
|
+
2. Present them to user
|
|
19
|
+
3. Execute a task
|
|
20
|
+
4. Mark it complete
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
tasks_file = '/home/jaguilar/aaxis/rnd/repositories/spec-kit-tcm-plan/specs/001-tcm-deployment-plan/tasks.md'
|
|
24
|
+
|
|
25
|
+
print("="*60)
|
|
26
|
+
print("ORCHESTRATOR WORKFLOW EXAMPLE")
|
|
27
|
+
print("="*60)
|
|
28
|
+
|
|
29
|
+
# Initialize TaskManager
|
|
30
|
+
tm = TaskManager(tasks_file)
|
|
31
|
+
|
|
32
|
+
# Step 1: Get project statistics
|
|
33
|
+
print("\n[STEP 1] Project Status Overview")
|
|
34
|
+
stats = tm.get_task_statistics()
|
|
35
|
+
print(f"Project Completion: {stats['completion_rate']}%")
|
|
36
|
+
print(f"Remaining Tasks: {stats['pending_tasks']}/{stats['total_tasks']}")
|
|
37
|
+
|
|
38
|
+
# Step 2: Get next pending tasks
|
|
39
|
+
print("\n[STEP 2] Next Pending Tasks")
|
|
40
|
+
pending_tasks = tm.get_pending_tasks(limit=5)
|
|
41
|
+
|
|
42
|
+
if not pending_tasks:
|
|
43
|
+
print("✅ No pending tasks - Project complete!")
|
|
44
|
+
return
|
|
45
|
+
|
|
46
|
+
print(f"\nFound {len(pending_tasks)} pending tasks:")
|
|
47
|
+
for i, task in enumerate(pending_tasks, 1):
|
|
48
|
+
print(f"{i}. {task['task_id']}: {task['title']}")
|
|
49
|
+
|
|
50
|
+
# Step 3: Get details for first pending task
|
|
51
|
+
print(f"\n[STEP 3] Task Details for {pending_tasks[0]['task_id']}")
|
|
52
|
+
task_details = tm.get_task_details(pending_tasks[0]['task_id'])
|
|
53
|
+
|
|
54
|
+
print(f"Task: {task_details['title']}")
|
|
55
|
+
print(f"Status: {task_details['status']}")
|
|
56
|
+
|
|
57
|
+
if task_details['metadata']['agent']:
|
|
58
|
+
print(f"Agent: {task_details['metadata']['agent']}")
|
|
59
|
+
print(f"Security Tier: {task_details['metadata']['security_tier']}")
|
|
60
|
+
|
|
61
|
+
if task_details['description']:
|
|
62
|
+
print(f"\nDescription:")
|
|
63
|
+
print(f" {task_details['description'][:150]}...")
|
|
64
|
+
|
|
65
|
+
if task_details['acceptance_criteria']:
|
|
66
|
+
print(f"\nAcceptance Criteria:")
|
|
67
|
+
for criterion in task_details['acceptance_criteria'][:3]:
|
|
68
|
+
print(f" - {criterion}")
|
|
69
|
+
|
|
70
|
+
# Step 4: Simulate task completion (COMMENTED OUT)
|
|
71
|
+
print(f"\n[STEP 4] Mark Task Complete (Simulated)")
|
|
72
|
+
print(f"NOTE: This is a DRY RUN - not actually marking task complete")
|
|
73
|
+
print(f"To actually mark complete, uncomment the following line:")
|
|
74
|
+
print(f" tm.mark_task_complete('{pending_tasks[0]['task_id']}')")
|
|
75
|
+
|
|
76
|
+
# Uncomment to actually mark task complete:
|
|
77
|
+
# result = tm.mark_task_complete(pending_tasks[0]['task_id'])
|
|
78
|
+
# if result:
|
|
79
|
+
# print(f"✅ Task {pending_tasks[0]['task_id']} marked complete")
|
|
80
|
+
# else:
|
|
81
|
+
# print(f"⚠️ Task {pending_tasks[0]['task_id']} was already complete")
|
|
82
|
+
|
|
83
|
+
print("\n" + "="*60)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def bulk_task_analysis_example():
|
|
87
|
+
"""
|
|
88
|
+
Example: Bulk analysis of all pending tasks
|
|
89
|
+
|
|
90
|
+
Shows how to analyze tasks by agent, security tier, etc.
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
tasks_file = '/home/jaguilar/aaxis/rnd/repositories/spec-kit-tcm-plan/specs/001-tcm-deployment-plan/tasks.md'
|
|
94
|
+
|
|
95
|
+
print("\n" + "="*60)
|
|
96
|
+
print("BULK TASK ANALYSIS EXAMPLE")
|
|
97
|
+
print("="*60)
|
|
98
|
+
|
|
99
|
+
tm = TaskManager(tasks_file)
|
|
100
|
+
|
|
101
|
+
# Get all pending tasks (use large limit)
|
|
102
|
+
pending_tasks = tm.get_pending_tasks(limit=100)
|
|
103
|
+
|
|
104
|
+
# Analyze by agent
|
|
105
|
+
print("\n[ANALYSIS] Tasks by Agent:")
|
|
106
|
+
agent_count = {}
|
|
107
|
+
|
|
108
|
+
for task in pending_tasks:
|
|
109
|
+
details = tm.get_task_details(task['task_id'])
|
|
110
|
+
agent = details['metadata'].get('agent', 'unassigned')
|
|
111
|
+
agent_count[agent] = agent_count.get(agent, 0) + 1
|
|
112
|
+
|
|
113
|
+
for agent, count in sorted(agent_count.items()):
|
|
114
|
+
print(f" {agent}: {count} tasks")
|
|
115
|
+
|
|
116
|
+
# Analyze by security tier
|
|
117
|
+
print("\n[ANALYSIS] Tasks by Security Tier:")
|
|
118
|
+
tier_count = {}
|
|
119
|
+
|
|
120
|
+
for task in pending_tasks:
|
|
121
|
+
details = tm.get_task_details(task['task_id'])
|
|
122
|
+
tier = details['metadata'].get('security_tier', 'unknown')
|
|
123
|
+
tier_count[tier] = tier_count.get(tier, 0) + 1
|
|
124
|
+
|
|
125
|
+
for tier, count in sorted(tier_count.items()):
|
|
126
|
+
print(f" {tier}: {count} tasks")
|
|
127
|
+
|
|
128
|
+
print("\n" + "="*60)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def quick_status_check_example():
|
|
132
|
+
"""
|
|
133
|
+
Example: Quick status check for a specific task
|
|
134
|
+
|
|
135
|
+
Shows how to quickly check task status and details
|
|
136
|
+
"""
|
|
137
|
+
|
|
138
|
+
tasks_file = '/home/jaguilar/aaxis/rnd/repositories/spec-kit-tcm-plan/specs/001-tcm-deployment-plan/tasks.md'
|
|
139
|
+
|
|
140
|
+
print("\n" + "="*60)
|
|
141
|
+
print("QUICK STATUS CHECK EXAMPLE")
|
|
142
|
+
print("="*60)
|
|
143
|
+
|
|
144
|
+
tm = TaskManager(tasks_file)
|
|
145
|
+
|
|
146
|
+
# Check specific tasks
|
|
147
|
+
task_ids = ['T001', 'T010', 'T020']
|
|
148
|
+
|
|
149
|
+
print("\n[CHECK] Task Status Summary:")
|
|
150
|
+
for task_id in task_ids:
|
|
151
|
+
try:
|
|
152
|
+
details = tm.get_task_details(task_id)
|
|
153
|
+
status_icon = '✅' if details['status'] == 'completed' else '⏳'
|
|
154
|
+
print(f"{status_icon} {task_id}: {details['status'].upper()}")
|
|
155
|
+
print(f" {details['title'][:60]}...")
|
|
156
|
+
except ValueError:
|
|
157
|
+
print(f"❌ {task_id}: NOT FOUND")
|
|
158
|
+
|
|
159
|
+
print("\n" + "="*60)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def error_handling_example():
|
|
163
|
+
"""
|
|
164
|
+
Example: Proper error handling with TaskManager
|
|
165
|
+
|
|
166
|
+
Shows how to handle common error scenarios
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
tasks_file = '/home/jaguilar/aaxis/rnd/repositories/spec-kit-tcm-plan/specs/001-tcm-deployment-plan/tasks.md'
|
|
170
|
+
|
|
171
|
+
print("\n" + "="*60)
|
|
172
|
+
print("ERROR HANDLING EXAMPLE")
|
|
173
|
+
print("="*60)
|
|
174
|
+
|
|
175
|
+
# Handle file not found
|
|
176
|
+
print("\n[EXAMPLE 1] Handle Missing File:")
|
|
177
|
+
try:
|
|
178
|
+
tm = TaskManager('/nonexistent/tasks.md')
|
|
179
|
+
except FileNotFoundError as e:
|
|
180
|
+
print(f"✅ Caught FileNotFoundError: File doesn't exist")
|
|
181
|
+
|
|
182
|
+
# Handle invalid task ID
|
|
183
|
+
print("\n[EXAMPLE 2] Handle Invalid Task ID:")
|
|
184
|
+
tm = TaskManager(tasks_file)
|
|
185
|
+
try:
|
|
186
|
+
details = tm.get_task_details('T999999')
|
|
187
|
+
except ValueError as e:
|
|
188
|
+
print(f"✅ Caught ValueError: Task doesn't exist")
|
|
189
|
+
|
|
190
|
+
# Handle already completed task
|
|
191
|
+
print("\n[EXAMPLE 3] Handle Already Completed Task:")
|
|
192
|
+
result = tm.mark_task_complete('T001') # T001 is already complete
|
|
193
|
+
if not result:
|
|
194
|
+
print(f"✅ Task already complete - no action taken")
|
|
195
|
+
|
|
196
|
+
# Handle invalid task format
|
|
197
|
+
print("\n[EXAMPLE 4] Handle Invalid Task Format:")
|
|
198
|
+
try:
|
|
199
|
+
tm.mark_task_complete('INVALID_ID')
|
|
200
|
+
except ValueError as e:
|
|
201
|
+
print(f"✅ Caught ValueError: Invalid task format")
|
|
202
|
+
|
|
203
|
+
print("\n" + "="*60)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
if __name__ == '__main__':
|
|
207
|
+
# Run all examples
|
|
208
|
+
orchestrator_workflow_example()
|
|
209
|
+
bulk_task_analysis_example()
|
|
210
|
+
quick_status_check_example()
|
|
211
|
+
error_handling_example()
|
|
212
|
+
|
|
213
|
+
print("\n" + "="*60)
|
|
214
|
+
print("ALL EXAMPLES COMPLETED SUCCESSFULLY ✅")
|
|
215
|
+
print("="*60)
|