Initial commit
This commit is contained in:
94
skills/nav-task/functions/index_updater.py
Executable file
94
skills/nav-task/functions/index_updater.py
Executable file
@@ -0,0 +1,94 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Update DEVELOPMENT-README.md task index with new task entry.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
from datetime import datetime
|
||||
|
||||
def update_task_index(task_file, status="Planning", description=""):
|
||||
"""
|
||||
Add task entry to DEVELOPMENT-README.md index.
|
||||
|
||||
Args:
|
||||
task_file: Task filename (e.g., TASK-10-feature-name.md)
|
||||
status: Task status (Planning, In Progress, Completed)
|
||||
description: Short task description
|
||||
|
||||
Returns:
|
||||
bool: True if updated successfully
|
||||
"""
|
||||
readme_path = ".agent/DEVELOPMENT-README.md"
|
||||
|
||||
if not os.path.exists(readme_path):
|
||||
print(f"Error: {readme_path} not found", file=sys.stderr)
|
||||
return False
|
||||
|
||||
# Extract task ID and title from filename
|
||||
match = re.match(r'(TASK-\d+)-(.*?)\.md', task_file)
|
||||
if not match:
|
||||
print(f"Error: Invalid task filename format: {task_file}", file=sys.stderr)
|
||||
return False
|
||||
|
||||
task_id = match.group(1)
|
||||
task_slug = match.group(2).replace('-', ' ').title()
|
||||
|
||||
# Read current README
|
||||
with open(readme_path, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# Find the task index section
|
||||
task_section_pattern = r'(### Implementation Plans \(`tasks/`\).*?)(###|\Z)'
|
||||
task_section_match = re.search(task_section_pattern, content, re.DOTALL)
|
||||
|
||||
if not task_section_match:
|
||||
print("Error: Could not find task index section", file=sys.stderr)
|
||||
return False
|
||||
|
||||
# Create new task entry
|
||||
status_emoji = {
|
||||
"Planning": "📋",
|
||||
"In Progress": "🚧",
|
||||
"Completed": "✅"
|
||||
}.get(status, "📋")
|
||||
|
||||
today = datetime.now().strftime("%Y-%m-%d")
|
||||
|
||||
new_entry = f"""
|
||||
#### [{task_id}: {task_slug}](./tasks/{task_file})
|
||||
**Status**: {status_emoji} {status}
|
||||
**Created**: {today}
|
||||
|
||||
**What**: {description or "Description pending"}
|
||||
|
||||
---
|
||||
"""
|
||||
|
||||
# Insert before the next section marker
|
||||
task_section = task_section_match.group(1)
|
||||
rest_of_doc = content[task_section_match.end(1):]
|
||||
|
||||
# Add new entry at the end of task section
|
||||
updated_section = task_section.rstrip() + "\n" + new_entry
|
||||
updated_content = content[:task_section_match.start(1)] + updated_section + rest_of_doc
|
||||
|
||||
# Write back
|
||||
with open(readme_path, 'w') as f:
|
||||
f.write(updated_content)
|
||||
|
||||
print(f"✅ Added {task_id} to DEVELOPMENT-README.md index")
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: index_updater.py <task-file> [status] [description]", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
task_file = sys.argv[1]
|
||||
status = sys.argv[2] if len(sys.argv) > 2 else "Planning"
|
||||
description = sys.argv[3] if len(sys.argv) > 3 else ""
|
||||
|
||||
success = update_task_index(task_file, status, description)
|
||||
sys.exit(0 if success else 1)
|
||||
121
skills/nav-task/functions/task_formatter.py
Executable file
121
skills/nav-task/functions/task_formatter.py
Executable file
@@ -0,0 +1,121 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Format task markdown with proper structure and metadata.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from datetime import datetime
|
||||
|
||||
def format_task(title, task_id, priority="Medium", complexity="Medium", status="Planning"):
|
||||
"""
|
||||
Generate formatted task markdown.
|
||||
|
||||
Args:
|
||||
title: Task title
|
||||
task_id: Task ID (e.g., TASK-10)
|
||||
priority: Priority level (Low, Medium, High, Critical)
|
||||
complexity: Complexity level (Low, Medium, High)
|
||||
status: Task status (Planning, In Progress, Completed)
|
||||
|
||||
Returns:
|
||||
str: Formatted markdown content
|
||||
"""
|
||||
today = datetime.now().strftime("%Y-%m-%d")
|
||||
|
||||
template = f"""# {task_id}: {title}
|
||||
|
||||
**Created**: {today}
|
||||
**Status**: {status}
|
||||
**Priority**: {priority}
|
||||
**Complexity**: {complexity}
|
||||
|
||||
---
|
||||
|
||||
## Context
|
||||
|
||||
[Describe the problem, feature request, or improvement needed]
|
||||
|
||||
**Problem**: [What needs to be solved?]
|
||||
|
||||
**Goal**: [What should be achieved?]
|
||||
|
||||
---
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
### Phase 1: [Phase Name]
|
||||
|
||||
**Tasks**:
|
||||
- [ ] Task 1
|
||||
- [ ] Task 2
|
||||
- [ ] Task 3
|
||||
|
||||
**Expected Outcome**: [What this phase delivers]
|
||||
|
||||
---
|
||||
|
||||
## Success Metrics
|
||||
|
||||
**Functionality**:
|
||||
- [ ] Feature works as expected
|
||||
- [ ] Edge cases handled
|
||||
- [ ] Error handling implemented
|
||||
|
||||
**Quality**:
|
||||
- [ ] Tests written and passing
|
||||
- [ ] Documentation updated
|
||||
- [ ] Code reviewed
|
||||
|
||||
**Token Efficiency** (if applicable):
|
||||
- [ ] Token usage measured
|
||||
- [ ] Optimization targets met
|
||||
- [ ] No context pollution
|
||||
|
||||
---
|
||||
|
||||
## Testing Plan
|
||||
|
||||
1. **Unit tests**: [What to test]
|
||||
2. **Integration tests**: [What to test]
|
||||
3. **Manual testing**: [Steps to verify]
|
||||
|
||||
---
|
||||
|
||||
## Related Tasks
|
||||
|
||||
- [Link to related tasks]
|
||||
|
||||
---
|
||||
|
||||
## Notes
|
||||
|
||||
- [Additional context, decisions, or considerations]
|
||||
|
||||
---
|
||||
|
||||
**Task created**: {today}
|
||||
**Priority**: {priority}
|
||||
**Effort**: {complexity}
|
||||
"""
|
||||
return template
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Format Navigator task markdown")
|
||||
parser.add_argument("--title", required=True, help="Task title")
|
||||
parser.add_argument("--id", required=True, help="Task ID (e.g., TASK-10)")
|
||||
parser.add_argument("--priority", default="Medium", choices=["Low", "Medium", "High", "Critical"])
|
||||
parser.add_argument("--complexity", default="Medium", choices=["Low", "Medium", "High"])
|
||||
parser.add_argument("--status", default="Planning", choices=["Planning", "In Progress", "Completed"])
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
output = format_task(
|
||||
title=args.title,
|
||||
task_id=args.id,
|
||||
priority=args.priority,
|
||||
complexity=args.complexity,
|
||||
status=args.status
|
||||
)
|
||||
|
||||
print(output)
|
||||
51
skills/nav-task/functions/task_id_generator.py
Executable file
51
skills/nav-task/functions/task_id_generator.py
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Generate next sequential TASK-XX ID by scanning existing task files.
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
def get_next_task_id(agent_dir=".agent", prefix="TASK"):
|
||||
"""
|
||||
Scan tasks/ directory and return next available TASK-XX ID.
|
||||
|
||||
Args:
|
||||
agent_dir: Path to .agent directory (default: .agent)
|
||||
prefix: Task ID prefix (default: TASK)
|
||||
|
||||
Returns:
|
||||
str: Next task ID (e.g., "TASK-10")
|
||||
"""
|
||||
tasks_dir = os.path.join(agent_dir, "tasks")
|
||||
|
||||
if not os.path.exists(tasks_dir):
|
||||
return f"{prefix}-01"
|
||||
|
||||
# Find all task files matching pattern TASK-XX-*.md
|
||||
task_pattern = re.compile(rf"{prefix}-(\d+)-.*\.md")
|
||||
task_numbers = []
|
||||
|
||||
for filename in os.listdir(tasks_dir):
|
||||
if filename == "archive": # Skip archive directory
|
||||
continue
|
||||
|
||||
match = task_pattern.match(filename)
|
||||
if match:
|
||||
task_numbers.append(int(match.group(1)))
|
||||
|
||||
if not task_numbers:
|
||||
return f"{prefix}-01"
|
||||
|
||||
# Get next sequential number
|
||||
next_num = max(task_numbers) + 1
|
||||
return f"{prefix}-{next_num:02d}"
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Support optional arguments
|
||||
agent_dir = sys.argv[1] if len(sys.argv) > 1 else ".agent"
|
||||
prefix = sys.argv[2] if len(sys.argv) > 2 else "TASK"
|
||||
|
||||
next_id = get_next_task_id(agent_dir, prefix)
|
||||
print(next_id)
|
||||
Reference in New Issue
Block a user