Refactor issue management and history tracking

- Removed the interactive issue management command and its associated documentation.
- Enhanced the issue planning command to streamline project context reading and solution creation.
- Improved queue management with conflict clarification and status syncing from queues.
- Added functionality to track completed issues, moving them to a history file upon completion.
- Updated CLI options to support syncing issue statuses from queues.
- Introduced new API endpoint for retrieving completed issues from history.
- Enhanced error handling and validation for issue updates and queue management.
This commit is contained in:
catlog22
2025-12-29 21:42:06 +08:00
parent 6ec6643448
commit fd48045fe3
8 changed files with 499 additions and 455 deletions

View File

@@ -1,6 +1,6 @@
---
name: issue-manage
description: Interactive issue management with menu-driven CRUD operations. Use when managing issues, viewing issue status, editing issue fields, or performing bulk operations on issues. Triggers on "manage issue", "list issues", "edit issue", "delete issue", "bulk update", "issue dashboard".
description: Interactive issue management with menu-driven CRUD operations. Use when managing issues, viewing issue status, editing issue fields, performing bulk operations, or viewing issue history. Triggers on "manage issue", "list issues", "edit issue", "delete issue", "bulk update", "issue dashboard", "issue history", "completed issues".
allowed-tools: Bash, Read, Write, AskUserQuestion, Task, Glob
---
@@ -16,17 +16,22 @@ Ask me:
- "Edit issue priority" → Modify fields
- "Delete old issues" → Remove with confirmation
- "Bulk update status" → Batch operations
- "Show completed issues" → View issue history
- "Archive old issues" → Move to history
## CLI Endpoints
```bash
# Core operations
ccw issue list # List all issues
ccw issue list # List active issues
ccw issue list <id> --json # Get issue details
ccw issue history # List completed issues (from history)
ccw issue history --json # Completed issues as JSON
ccw issue status <id> # Detailed status
ccw issue init <id> --title "..." # Create issue
ccw issue task <id> --title "..." # Add task
ccw issue bind <id> <solution-id> # Bind solution
ccw issue update <id> --status completed # Complete & auto-archive
# Queue management
ccw issue queue # List current queue
@@ -37,6 +42,7 @@ ccw issue queue archive # Archive queue
ccw issue queue delete <queue-id> # Delete queue
ccw issue next # Get next task
ccw issue done <queue-id> # Mark completed
ccw issue update --from-queue # Sync statuses from queue
```
## Operations
@@ -113,7 +119,29 @@ This will also remove:
3. Clean up `solutions/<id>.jsonl`
4. Remove from `queue.json`
### 5. BULK 📦
### 5. HISTORY 📚
View and manage completed issues:
```
┌─ Issue History ─────────────────────┐
│ ID Completed Title │
│ ISS-001 2025-12-28 12:00 Fix bug │
│ ISS-002 2025-12-27 15:30 Feature │
└──────────────────────────────────────┘
```
**Flow**:
1. Fetch `ccw issue history --json`
2. Display table: ID | Completed At | Title
3. Optional: Filter by date range
**Auto-Archive**: When issue status → `completed`:
- Issue moves from `issues.jsonl``issue-history.jsonl`
- Solutions remain in `solutions/<id>.jsonl`
- Queue items marked completed
### 6. BULK 📦
Batch operations:
@@ -125,25 +153,34 @@ Batch operations:
| Delete Multiple | Bulk removal |
| Queue All Planned | Add all planned to queue |
| Retry All Failed | Reset failed tasks |
| Sync from Queue | Update statuses from active queue |
## Workflow
```
┌──────────────────────────────────────┐
│ Main Menu │
│ ┌────┐ ┌────┐ ┌────┐ ┌────
│ │List│ │View│ │Edit│ │Bulk│ │
│ └──┬─┘ └──┬─┘ └──┬─┘ └──┬─
└─────┼──────┼──────┼──────┼──────────┘
│ │ │ │
▼ ▼ ▼ ▼
Filter Detail Fields Multi
Select Actions Update Select
│ │ │ │
└──────┴──────┴──────┘
Back to Menu
┌────────────────────────────────────────────────
Main Menu
│ ┌────┐ ┌────┐ ┌────┐ ┌─────┐ ┌────┐
│ │List│ │View│ │Edit│ │Hist.│ │Bulk│
│ └──┬─┘ └──┬─┘ └──┬─┘ └──┬──┘ └──┬─┘
└─────┼──────┼──────┼──────┼───────┼─────────────┘
│ │ │ │
▼ ▼ ▼ ▼
Filter Detail Fields History Multi
Select Actions Update Browse Select
│ │ │ │
└──────┴──────┴──────┴───────
Back to Menu
```
**Issue Lifecycle**:
```
registered → planned → queued → executing → completed
issue-history.jsonl
```
## Implementation Guide
@@ -163,10 +200,11 @@ await showMainMenu(issueId);
```javascript
// 1. Fetch dashboard data
const issues = JSON.parse(Bash('ccw issue list --json') || '[]');
const history = JSON.parse(Bash('ccw issue history --json 2>/dev/null') || '[]');
const queue = JSON.parse(Bash('ccw issue queue --json 2>/dev/null') || '{}');
// 2. Display summary
console.log(`Issues: ${issues.length} | Queue: ${queue.pending_count || 0} pending`);
console.log(`Active: ${issues.length} | Completed: ${history.length} | Queue: ${queue.pending_count || 0} pending`);
// 3. Ask action via AskUserQuestion
const action = AskUserQuestion({
@@ -174,9 +212,10 @@ const action = AskUserQuestion({
question: 'What would you like to do?',
header: 'Action',
options: [
{ label: 'List Issues', description: 'Browse with filters' },
{ label: 'List Issues', description: 'Browse active issues' },
{ label: 'View Issue', description: 'Detail view' },
{ label: 'Edit Issue', description: 'Modify fields' },
{ label: 'View History', description: 'Completed issues' },
{ label: 'Bulk Operations', description: 'Batch actions' }
]
}]
@@ -223,9 +262,11 @@ const issuesPath = '.workflow/issues/issues.jsonl';
| File | Purpose |
|------|---------|
| `.workflow/issues/issues.jsonl` | Issue records |
| `.workflow/issues/issues.jsonl` | Active issue records |
| `.workflow/issues/issue-history.jsonl` | Completed issues (archived) |
| `.workflow/issues/solutions/<id>.jsonl` | Solutions per issue |
| `.workflow/issues/queue.json` | Execution queue |
| `.workflow/issues/queues/index.json` | Queue index (multi-queue) |
| `.workflow/issues/queues/<queue-id>.json` | Individual queue files |
## Error Handling