sqlew 4.0.5 → 4.1.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 +1805 -1782
- package/README.md +409 -468
- package/assets/claude-md-snippets/plan-mode-integration.md +17 -6
- package/assets/config.example.toml +282 -284
- package/assets/sample-agents/README.md +36 -40
- package/assets/sample-agents/sqlew-architect.md +321 -322
- package/assets/sample-agents/sqlew-researcher.md +292 -293
- package/assets/sample-agents/sqlew-scrum-master.md +286 -287
- package/assets/sample-commands/README.md +56 -57
- package/assets/sample-skills/sqlew-plan-guidance/SKILL.md +33 -26
- package/dist/cli/hooks/check-completion.d.ts +19 -0
- package/dist/cli/hooks/check-completion.d.ts.map +1 -0
- package/dist/cli/hooks/check-completion.js +104 -0
- package/dist/cli/hooks/check-completion.js.map +1 -0
- package/dist/cli/hooks/init-hooks.d.ts +35 -0
- package/dist/cli/hooks/init-hooks.d.ts.map +1 -0
- package/dist/cli/hooks/init-hooks.js +425 -0
- package/dist/cli/hooks/init-hooks.js.map +1 -0
- package/dist/cli/hooks/mark-done.d.ts +25 -0
- package/dist/cli/hooks/mark-done.d.ts.map +1 -0
- package/dist/cli/hooks/mark-done.js +128 -0
- package/dist/cli/hooks/mark-done.js.map +1 -0
- package/dist/cli/hooks/plan-id-utils.d.ts +83 -0
- package/dist/cli/hooks/plan-id-utils.d.ts.map +1 -0
- package/dist/cli/hooks/plan-id-utils.js +183 -0
- package/dist/cli/hooks/plan-id-utils.js.map +1 -0
- package/dist/cli/hooks/save.d.ts +23 -0
- package/dist/cli/hooks/save.d.ts.map +1 -0
- package/dist/cli/hooks/save.js +90 -0
- package/dist/cli/hooks/save.js.map +1 -0
- package/dist/cli/hooks/stdin-parser.d.ts +139 -0
- package/dist/cli/hooks/stdin-parser.d.ts.map +1 -0
- package/dist/cli/hooks/stdin-parser.js +127 -0
- package/dist/cli/hooks/stdin-parser.js.map +1 -0
- package/dist/cli/hooks/suggest.d.ts +19 -0
- package/dist/cli/hooks/suggest.d.ts.map +1 -0
- package/dist/cli/hooks/suggest.js +157 -0
- package/dist/cli/hooks/suggest.js.map +1 -0
- package/dist/cli/hooks/track-plan.d.ts +36 -0
- package/dist/cli/hooks/track-plan.d.ts.map +1 -0
- package/dist/cli/hooks/track-plan.js +152 -0
- package/dist/cli/hooks/track-plan.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +56 -16
- package/dist/cli.js.map +1 -1
- package/dist/config/global-config.d.ts +187 -0
- package/dist/config/global-config.d.ts.map +1 -0
- package/dist/config/global-config.js +206 -0
- package/dist/config/global-config.js.map +1 -0
- package/dist/config/loader.d.ts +42 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +96 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -1
- package/dist/database/operations/queries.d.ts.map +1 -1
- package/dist/database/operations/queries.js +11 -2
- package/dist/database/operations/queries.js.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/init-agents.js +0 -1
- package/dist/init-agents.js.map +1 -1
- package/dist/init-skills.d.ts +4 -3
- package/dist/init-skills.d.ts.map +1 -1
- package/dist/init-skills.js +10 -3
- package/dist/init-skills.js.map +1 -1
- package/dist/server/setup.d.ts +8 -0
- package/dist/server/setup.d.ts.map +1 -1
- package/dist/server/setup.js +141 -21
- package/dist/server/setup.js.map +1 -1
- package/dist/sync-agents.d.ts.map +1 -1
- package/dist/sync-agents.js +48 -3
- package/dist/sync-agents.js.map +1 -1
- package/dist/sync-commands.d.ts.map +1 -1
- package/dist/sync-commands.js +43 -3
- package/dist/sync-commands.js.map +1 -1
- package/dist/tools/constraints/actions/get.d.ts.map +1 -1
- package/dist/tools/constraints/actions/get.js +5 -8
- package/dist/tools/constraints/actions/get.js.map +1 -1
- package/dist/tools/constraints/help/help.d.ts.map +1 -1
- package/dist/tools/constraints/help/help.js +1 -6
- package/dist/tools/constraints/help/help.js.map +1 -1
- package/dist/tools/context/actions/get.d.ts.map +1 -1
- package/dist/tools/context/actions/get.js.map +1 -1
- package/dist/tools/context/actions/search-layer.d.ts.map +1 -1
- package/dist/tools/context/actions/search-layer.js +5 -3
- package/dist/tools/context/actions/search-layer.js.map +1 -1
- package/dist/tools/context/actions/set-from-policy.d.ts +2 -1
- package/dist/tools/context/actions/set-from-policy.d.ts.map +1 -1
- package/dist/tools/context/actions/set-from-policy.js.map +1 -1
- package/dist/tools/context/help/help.d.ts.map +1 -1
- package/dist/tools/context/help/help.js +1 -7
- package/dist/tools/context/help/help.js.map +1 -1
- package/dist/tools/context/internal/queries.d.ts.map +1 -1
- package/dist/tools/context/internal/queries.js +5 -2
- package/dist/tools/context/internal/queries.js.map +1 -1
- package/dist/tools/context/types.d.ts +1 -1
- package/dist/tools/context/types.d.ts.map +1 -1
- package/dist/tools/files/actions/get.d.ts.map +1 -1
- package/dist/tools/files/actions/get.js +4 -6
- package/dist/tools/files/actions/get.js.map +1 -1
- package/dist/tools/files/help/help.d.ts.map +1 -1
- package/dist/tools/files/help/help.js +1 -6
- package/dist/tools/files/help/help.js.map +1 -1
- package/dist/tools/suggest/help/constraint-help.d.ts.map +1 -1
- package/dist/tools/suggest/help/constraint-help.js +0 -2
- package/dist/tools/suggest/help/constraint-help.js.map +1 -1
- package/dist/tools/suggest/internal/constraint-queries.d.ts.map +1 -1
- package/dist/tools/suggest/internal/constraint-queries.js +12 -5
- package/dist/tools/suggest/internal/constraint-queries.js.map +1 -1
- package/dist/tools/suggest/internal/queries.js +2 -2
- package/dist/tools/suggest/internal/queries.js.map +1 -1
- package/dist/tools/tasks/help/help.d.ts.map +1 -1
- package/dist/tools/tasks/help/help.js +0 -6
- package/dist/tools/tasks/help/help.js.map +1 -1
- package/dist/tools/tasks/help/use-case.d.ts.map +1 -1
- package/dist/tools/tasks/help/use-case.js +0 -1
- package/dist/tools/tasks/help/use-case.js.map +1 -1
- package/dist/tools/tasks/watcher/status.d.ts.map +1 -1
- package/dist/tools/tasks/watcher/status.js +5 -1
- package/dist/tools/tasks/watcher/status.js.map +1 -1
- package/dist/types/decision/params.d.ts +7 -6
- package/dist/types/decision/params.d.ts.map +1 -1
- package/dist/types/decision/templates.d.ts +3 -2
- package/dist/types/decision/templates.d.ts.map +1 -1
- package/dist/types/view-entities.d.ts +2 -1
- package/dist/types/view-entities.d.ts.map +1 -1
- package/dist/types.d.ts +19 -11
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/enum-converter.d.ts +72 -0
- package/dist/utils/enum-converter.d.ts.map +1 -0
- package/dist/utils/enum-converter.js +76 -0
- package/dist/utils/enum-converter.js.map +1 -0
- package/dist/utils/hook-queue.d.ts +81 -0
- package/dist/utils/hook-queue.d.ts.map +1 -0
- package/dist/utils/hook-queue.js +156 -0
- package/dist/utils/hook-queue.js.map +1 -0
- package/dist/utils/project-root.d.ts +9 -2
- package/dist/utils/project-root.d.ts.map +1 -1
- package/dist/utils/project-root.js +16 -2
- package/dist/utils/project-root.js.map +1 -1
- package/dist/utils/tag-parser.d.ts.map +1 -1
- package/dist/utils/tag-parser.js +6 -0
- package/dist/utils/tag-parser.js.map +1 -1
- package/dist/utils/validators.d.ts +1 -1
- package/dist/utils/validators.d.ts.map +1 -1
- package/dist/utils/validators.js +1 -1
- package/dist/utils/validators.js.map +1 -1
- package/dist/utils/vcs-adapter.d.ts +44 -0
- package/dist/utils/vcs-adapter.d.ts.map +1 -1
- package/dist/utils/vcs-adapter.js +88 -0
- package/dist/utils/vcs-adapter.js.map +1 -1
- package/dist/utils/view-queries.d.ts.map +1 -1
- package/dist/utils/view-queries.js +9 -19
- package/dist/utils/view-queries.js.map +1 -1
- package/dist/watcher/base-watcher.d.ts +69 -0
- package/dist/watcher/base-watcher.d.ts.map +1 -0
- package/dist/watcher/base-watcher.js +130 -0
- package/dist/watcher/base-watcher.js.map +1 -0
- package/dist/watcher/index.d.ts +3 -0
- package/dist/watcher/index.d.ts.map +1 -1
- package/dist/watcher/index.js +2 -0
- package/dist/watcher/index.js.map +1 -1
- package/dist/watcher/queue-watcher.d.ts +64 -0
- package/dist/watcher/queue-watcher.d.ts.map +1 -0
- package/dist/watcher/queue-watcher.js +187 -0
- package/dist/watcher/queue-watcher.js.map +1 -0
- package/docs/ADR_CONCEPTS.md +140 -0
- package/docs/CONFIGURATION.md +922 -925
- package/docs/CROSS_DATABASE.md +153 -0
- package/docs/DATABASE_AUTH.md +70 -356
- package/docs/HOOKS_GUIDE.md +159 -0
- package/docs/SLASH_COMMANDS.md +329 -337
- package/docs/TASK_SYSTEM_DEPRECATED.md +88 -0
- package/docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md +293 -296
- package/docs/cli/DATA_EXPORT_IMPORT.md +699 -700
- package/docs/cli/README.md +276 -277
- package/package.json +123 -124
- package/docs/ACCEPTANCE_CRITERIA.md +0 -625
- package/docs/AI_AGENT_GUIDE.md +0 -299
- package/docs/ARCHITECTURE.md +0 -167
- package/docs/AUTO_FILE_TRACKING.md +0 -841
- package/docs/BATCH_VALIDATION.md +0 -617
- package/docs/BEST_PRACTICES.md +0 -168
- package/docs/CONSTRAINT_INTELLIGENCE.md +0 -339
- package/docs/DECISION_CONTEXT.md +0 -697
- package/docs/DECISION_INTELLIGENCE.md +0 -605
- package/docs/GIT_AWARE_AUTO_COMPLETE.md +0 -646
- package/docs/MIGRATION_GUIDE_V3.9.0.md +0 -371
- package/docs/SHARED_CONCEPTS.md +0 -225
- package/docs/SPECIALIZED_AGENTS.md +0 -126
- package/docs/TASK_ACTIONS.md +0 -1177
- package/docs/TASK_OVERVIEW.md +0 -452
- package/docs/TASK_PRUNING.md +0 -594
- package/docs/TOOL_REFERENCE.md +0 -1077
- package/docs/TOOL_SELECTION.md +0 -83
- package/docs/WORKFLOWS.md +0 -941
|
@@ -1,646 +0,0 @@
|
|
|
1
|
-
# Git-Aware Auto-Complete (v3.4.0 - v4.0.0)
|
|
2
|
-
|
|
3
|
-
**Feature Status**: Implemented ✅
|
|
4
|
-
**Current Version**: v4.0.0 (Two-Step Git-Aware Workflow with v4_ Table Prefix)
|
|
5
|
-
**Previous Version**: v3.5.2 (Two-Step Git-Aware Workflow)
|
|
6
|
-
**Original Version**: v3.4.0 (Commit-Based Auto-Complete)
|
|
7
|
-
**Architecture Decision**: #001 - Replace flawed auto-revert with Git-based task completion
|
|
8
|
-
|
|
9
|
-
## Version Evolution
|
|
10
|
-
|
|
11
|
-
### v3.4.0 - Commit-Based Auto-Complete
|
|
12
|
-
- **Workflow**: `waiting_review` → [git commit] → `done`
|
|
13
|
-
- **Problem**: Tasks stay in `done` status indefinitely, board becomes cluttered
|
|
14
|
-
|
|
15
|
-
### v3.5.2 - Two-Step Git-Aware Workflow ⭐ **NEW**
|
|
16
|
-
- **Step 1 - Staging**: `waiting_review` → [git add] → `done` (work complete)
|
|
17
|
-
- **Step 2 - Archiving**: `done` → [git commit] → `archived` (work finalized, board clean)
|
|
18
|
-
- **Benefit**: Automatic board cleanup while preserving Git workflow semantics
|
|
19
|
-
|
|
20
|
-
## Problem Statement
|
|
21
|
-
|
|
22
|
-
### Current Flaw (v3.2.x - v3.3.x)
|
|
23
|
-
|
|
24
|
-
The current stale task detection system has a critical design flaw:
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
// In src/utils/task-stale-detection.ts lines 105-116
|
|
28
|
-
// FLAWED LOGIC: Reverts completed work after 24h idle
|
|
29
|
-
const waitingReviewTransitioned = db.prepare(`
|
|
30
|
-
UPDATE v4_tasks
|
|
31
|
-
SET status_id = ?,
|
|
32
|
-
updated_ts = unixepoch()
|
|
33
|
-
WHERE status_id = ?
|
|
34
|
-
AND updated_ts < unixepoch() - ?
|
|
35
|
-
`).run(
|
|
36
|
-
TASK_STATUS.TODO, // Revert to TODO
|
|
37
|
-
TASK_STATUS.WAITING_REVIEW, // From waiting_review
|
|
38
|
-
waitingReviewThresholdSeconds // After 24h
|
|
39
|
-
);
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Problem**:
|
|
43
|
-
- Task transitions: `todo` → `in_progress` → `waiting_review` (quality gates pass)
|
|
44
|
-
- After 24h idle: `waiting_review` → `todo` (auto-revert)
|
|
45
|
-
- **Result**: Work is DONE but task status discards this fact
|
|
46
|
-
|
|
47
|
-
### Why This Happens
|
|
48
|
-
|
|
49
|
-
1. AI agent completes implementation (files modified, tests pass, TypeScript compiles)
|
|
50
|
-
2. Quality gates detect completion → task moves to `waiting_review`
|
|
51
|
-
3. Work sits idle for 24+ hours (no additional changes needed)
|
|
52
|
-
4. Auto-revert logic triggers → task reverts to `todo`
|
|
53
|
-
5. **Loss of context**: Task appears incomplete when work is already done
|
|
54
|
-
|
|
55
|
-
## Solution: Two-Step Git-Aware Workflow (v3.5.2)
|
|
56
|
-
|
|
57
|
-
### Core Concept
|
|
58
|
-
|
|
59
|
-
**Align task status with Git workflow stages.**
|
|
60
|
-
|
|
61
|
-
- **Staging (git add)** = Work complete → `waiting_review` → `done`
|
|
62
|
-
- **Committing (git commit)** = Work finalized → `done` → `archived`
|
|
63
|
-
|
|
64
|
-
### Rationale (v3.5.2 Enhancement)
|
|
65
|
-
|
|
66
|
-
1. **Clean Task Board**: Tasks auto-archive after commit, keeping active board focused on current work
|
|
67
|
-
2. **Fast Feedback**: `git add` provides immediate "work done" signal (faster than waiting for commit)
|
|
68
|
-
3. **Git Workflow Alignment**: Staging = ready for review, Commit = finalized and permanent
|
|
69
|
-
4. **Zero-token overhead**: Fully automated, no manual MCP calls needed
|
|
70
|
-
5. **Multi-agent compatible**: Any agent can stage/commit, all agents see the same VCS state
|
|
71
|
-
6. **Survives process restarts**: VCS state is persistent (Git/Mercurial/SVN)
|
|
72
|
-
|
|
73
|
-
## Architecture
|
|
74
|
-
|
|
75
|
-
### Component Design
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
79
|
-
│ Git-Aware Task Completion System │
|
|
80
|
-
│ │
|
|
81
|
-
│ ┌───────────────────────────────────────────────────────────┐ │
|
|
82
|
-
│ │ detectAndCompleteReviewedTasks(db: Database) │ │
|
|
83
|
-
│ │ ─────────────────────────────────────────────────────── │ │
|
|
84
|
-
│ │ 1. Find all tasks in waiting_review status │ │
|
|
85
|
-
│ │ 2. Get watched files for each task │ │
|
|
86
|
-
│ │ 3. Check Git log since task creation │ │
|
|
87
|
-
│ │ 4. If ALL files committed → transition to done │ │
|
|
88
|
-
│ │ 5. Return count of auto-completed tasks │ │
|
|
89
|
-
│ └───────────────────────────────────────────────────────────┘ │
|
|
90
|
-
│ │
|
|
91
|
-
│ ┌───────────────────────────────────────────────────────────┐ │
|
|
92
|
-
│ │ Integration Points │ │
|
|
93
|
-
│ │ ─────────────────────────────────────────────────────── │ │
|
|
94
|
-
│ │ • Periodic Checks: Before task.list() and stats.get() │ │
|
|
95
|
-
│ │ • File Watcher: On .git/index change (real-time) │ │
|
|
96
|
-
│ │ • Response Enhancement: Include git_auto_completed │ │
|
|
97
|
-
│ └───────────────────────────────────────────────────────────┘ │
|
|
98
|
-
│ │
|
|
99
|
-
│ ┌───────────────────────────────────────────────────────────┐ │
|
|
100
|
-
│ │ Configuration │ │
|
|
101
|
-
│ │ ─────────────────────────────────────────────────────── │ │
|
|
102
|
-
│ │ • git_auto_complete_enabled (default: '1') │ │
|
|
103
|
-
│ │ • require_all_files_committed (default: '1') │ │
|
|
104
|
-
│ │ • stale_review_notification_hours (default: '48') │ │
|
|
105
|
-
│ └───────────────────────────────────────────────────────────┘ │
|
|
106
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Git Log Query Strategy
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# For a task created at timestamp 1698765432
|
|
113
|
-
# Check if file "src/auth.ts" was committed since task creation
|
|
114
|
-
|
|
115
|
-
git log --since="@1698765432" --name-only -- src/auth.ts
|
|
116
|
-
|
|
117
|
-
# Output if committed:
|
|
118
|
-
# commit abc123def456...
|
|
119
|
-
# Author: AI Agent <agent@example.com>
|
|
120
|
-
# Date: ...
|
|
121
|
-
#
|
|
122
|
-
# src/auth.ts
|
|
123
|
-
|
|
124
|
-
# Output if NOT committed:
|
|
125
|
-
# (empty)
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
**Logic**:
|
|
129
|
-
- Query `git log --since="@<task.created_ts>" --name-only -- <file_path>`
|
|
130
|
-
- If output is non-empty → file was committed since task creation
|
|
131
|
-
- If ALL watched files have non-empty output → transition task to `done`
|
|
132
|
-
|
|
133
|
-
## Implementation Tasks
|
|
134
|
-
|
|
135
|
-
### Task 1: Remove Flawed Auto-Revert Logic
|
|
136
|
-
**Priority**: Critical (Blocker)
|
|
137
|
-
**Layer**: Business Logic
|
|
138
|
-
**AI Time**: 5 minutes
|
|
139
|
-
**Token Budget**: 2k-3k tokens
|
|
140
|
-
|
|
141
|
-
**File**: `src/utils/task-stale-detection.ts`
|
|
142
|
-
**Lines to Remove**: 105-116
|
|
143
|
-
|
|
144
|
-
```typescript
|
|
145
|
-
// DELETE THIS SECTION:
|
|
146
|
-
const waitingReviewTransitioned = db.prepare(`
|
|
147
|
-
UPDATE t_tasks
|
|
148
|
-
SET status_id = ?,
|
|
149
|
-
updated_ts = unixepoch()
|
|
150
|
-
WHERE status_id = ?
|
|
151
|
-
AND updated_ts < unixepoch() - ?
|
|
152
|
-
`).run(
|
|
153
|
-
TASK_STATUS.TODO,
|
|
154
|
-
TASK_STATUS.WAITING_REVIEW,
|
|
155
|
-
waitingReviewThresholdSeconds
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
totalTransitioned += waitingReviewTransitioned.changes;
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
**Acceptance Criteria**:
|
|
162
|
-
- [ ] Lines 105-116 removed from `task-stale-detection.ts`
|
|
163
|
-
- [ ] No compilation errors after removal
|
|
164
|
-
- [ ] Existing tests still pass (`npm test task-stale`)
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
### Task 2: Implement Git-Aware Auto-Complete
|
|
169
|
-
**Priority**: Critical (Blocker)
|
|
170
|
-
**Layer**: Business Logic
|
|
171
|
-
**AI Time**: 25-30 minutes
|
|
172
|
-
**Token Budget**: 18k-25k tokens
|
|
173
|
-
|
|
174
|
-
**New Function**: `detectAndCompleteReviewedTasks(db: Database): Promise<number>`
|
|
175
|
-
**Location**: `src/utils/task-stale-detection.ts`
|
|
176
|
-
|
|
177
|
-
**Function Signature**:
|
|
178
|
-
```typescript
|
|
179
|
-
/**
|
|
180
|
-
* Detect and auto-complete tasks in waiting_review that have all files committed
|
|
181
|
-
*
|
|
182
|
-
* Git-aware completion logic:
|
|
183
|
-
* - Find all tasks in waiting_review status
|
|
184
|
-
* - Get watched files for each task
|
|
185
|
-
* - Check git log since task creation for each file
|
|
186
|
-
* - If ALL files committed → transition to done
|
|
187
|
-
*
|
|
188
|
-
* @param db - Database instance
|
|
189
|
-
* @returns Count of auto-completed tasks
|
|
190
|
-
*/
|
|
191
|
-
export async function detectAndCompleteReviewedTasks(db: Database): Promise<number> {
|
|
192
|
-
// Implementation here
|
|
193
|
-
}
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
**Algorithm**:
|
|
197
|
-
```
|
|
198
|
-
1. Check if git_auto_complete_enabled config is true
|
|
199
|
-
2. Get all tasks in waiting_review status
|
|
200
|
-
3. For each task:
|
|
201
|
-
a. Get list of watched files from v4_task_file_links
|
|
202
|
-
b. Get task.created_ts
|
|
203
|
-
c. For each watched file:
|
|
204
|
-
- Run: git log --since="@<created_ts>" --name-only -- <file_path>
|
|
205
|
-
- If output is empty → file NOT committed
|
|
206
|
-
d. If require_all_files_committed:
|
|
207
|
-
- ALL files must be committed → transition to done
|
|
208
|
-
e. Else:
|
|
209
|
-
- ANY file committed → transition to done
|
|
210
|
-
4. Return count of transitioned tasks
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
**Error Handling**:
|
|
214
|
-
- Skip tasks if `git log` fails (not in a Git repo)
|
|
215
|
-
- Skip tasks with no watched files
|
|
216
|
-
- Log detailed diagnostics to stderr for debugging
|
|
217
|
-
|
|
218
|
-
**Acceptance Criteria**:
|
|
219
|
-
- [ ] Function implemented in `task-stale-detection.ts`
|
|
220
|
-
- [ ] Handles all edge cases (no Git repo, no watched files, partial commits)
|
|
221
|
-
- [ ] Respects `git_auto_complete_enabled` and `require_all_files_committed` config
|
|
222
|
-
- [ ] Returns accurate count of transitioned tasks
|
|
223
|
-
- [ ] Comprehensive error logging to stderr
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
### Task 3: Integration - Periodic Checks
|
|
228
|
-
**Priority**: High
|
|
229
|
-
**Layer**: Business Logic
|
|
230
|
-
**Dependencies**: Task 2
|
|
231
|
-
**AI Time**: 10-15 minutes
|
|
232
|
-
**Token Budget**: 8k-12k tokens
|
|
233
|
-
|
|
234
|
-
**Files**: `src/tools/tasks.ts`
|
|
235
|
-
**Actions to Modify**: `list` (line ~750), `stats` in utils.ts
|
|
236
|
-
|
|
237
|
-
**Changes**:
|
|
238
|
-
1. Call `detectAndCompleteReviewedTasks(db)` before returning results
|
|
239
|
-
2. Include `git_auto_completed` count in response
|
|
240
|
-
|
|
241
|
-
**Example Integration**:
|
|
242
|
-
```typescript
|
|
243
|
-
// In listTasks() function
|
|
244
|
-
async function listTasks(db: Database, params: ListTasksParams): Promise<object> {
|
|
245
|
-
// Run stale detection (existing)
|
|
246
|
-
const staleTransitioned = detectAndTransitionStaleTasks(db);
|
|
247
|
-
|
|
248
|
-
// NEW: Run Git-aware auto-complete
|
|
249
|
-
const gitAutoCompleted = await detectAndCompleteReviewedTasks(db);
|
|
250
|
-
|
|
251
|
-
// Get task list
|
|
252
|
-
const tasks = db.prepare('SELECT ...).all();
|
|
253
|
-
|
|
254
|
-
return {
|
|
255
|
-
tasks,
|
|
256
|
-
stale_tasks_transitioned: staleTransitioned,
|
|
257
|
-
git_auto_completed: gitAutoCompleted, // NEW
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
**Acceptance Criteria**:
|
|
263
|
-
- [ ] `task.list` calls `detectAndCompleteReviewedTasks()` before listing
|
|
264
|
-
- [ ] `stats` tool calls `detectAndCompleteReviewedTasks()` before stats
|
|
265
|
-
- [ ] Response includes `git_auto_completed` count
|
|
266
|
-
- [ ] Async handling properly implemented (await)
|
|
267
|
-
- [ ] No performance degradation for large task lists
|
|
268
|
-
|
|
269
|
-
---
|
|
270
|
-
|
|
271
|
-
### Task 4: Integration - File Watcher
|
|
272
|
-
**Priority**: High
|
|
273
|
-
**Layer**: Infrastructure
|
|
274
|
-
**Dependencies**: Task 2
|
|
275
|
-
**AI Time**: 15-20 minutes
|
|
276
|
-
**Token Budget**: 10k-15k tokens
|
|
277
|
-
|
|
278
|
-
**Files**:
|
|
279
|
-
- `src/watcher/file-watcher.ts`
|
|
280
|
-
- `src/watcher/index.ts`
|
|
281
|
-
|
|
282
|
-
**Changes**:
|
|
283
|
-
1. Watch `.git/index` file for changes (indicates git commit)
|
|
284
|
-
2. On `.git/index` change → call `detectAndCompleteReviewedTasks(db)`
|
|
285
|
-
3. Log real-time auto-completions
|
|
286
|
-
|
|
287
|
-
**Implementation**:
|
|
288
|
-
```typescript
|
|
289
|
-
// In FileWatcher constructor
|
|
290
|
-
this.watcher = chokidar.watch([...filePaths, '.git/index'], {
|
|
291
|
-
ignored: gitignoreParser.shouldIgnore,
|
|
292
|
-
persistent: true,
|
|
293
|
-
ignoreInitial: true,
|
|
294
|
-
awaitWriteFinish: {
|
|
295
|
-
stabilityThreshold: 2000,
|
|
296
|
-
pollInterval: 100,
|
|
297
|
-
},
|
|
298
|
-
});
|
|
299
|
-
|
|
300
|
-
// In change handler
|
|
301
|
-
this.watcher.on('change', async (path) => {
|
|
302
|
-
if (path === '.git/index') {
|
|
303
|
-
// Git commit detected
|
|
304
|
-
const completed = await detectAndCompleteReviewedTasks(this.db);
|
|
305
|
-
if (completed > 0) {
|
|
306
|
-
console.error(` ✓ Git-aware auto-complete: ${completed} tasks completed`);
|
|
307
|
-
}
|
|
308
|
-
} else {
|
|
309
|
-
// Existing file change logic
|
|
310
|
-
...
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
**Acceptance Criteria**:
|
|
316
|
-
- [ ] `.git/index` added to watch list
|
|
317
|
-
- [ ] Git commits trigger `detectAndCompleteReviewedTasks()`
|
|
318
|
-
- [ ] Real-time console output for auto-completions
|
|
319
|
-
- [ ] No performance impact from watching `.git/index`
|
|
320
|
-
- [ ] Graceful handling if `.git/index` doesn't exist (not a Git repo)
|
|
321
|
-
|
|
322
|
-
---
|
|
323
|
-
|
|
324
|
-
### Task 5: Enhanced Inline Status
|
|
325
|
-
**Priority**: Medium
|
|
326
|
-
**Layer**: Presentation
|
|
327
|
-
**Dependencies**: Task 3
|
|
328
|
-
**AI Time**: 10 minutes
|
|
329
|
-
**Token Budget**: 5k-8k tokens
|
|
330
|
-
|
|
331
|
-
**File**: `src/tools/utils.ts` (stats action)
|
|
332
|
-
|
|
333
|
-
**Changes**:
|
|
334
|
-
Add `review_status` section to stats output showing tasks awaiting Git commits:
|
|
335
|
-
|
|
336
|
-
```typescript
|
|
337
|
-
// In getStats() function
|
|
338
|
-
const reviewStatus = db.prepare(`
|
|
339
|
-
SELECT
|
|
340
|
-
COUNT(DISTINCT t.id) as awaiting_commit,
|
|
341
|
-
COUNT(DISTINCT tfl.file_id) as total_files,
|
|
342
|
-
COUNT(DISTINCT CASE WHEN <committed_check> THEN tfl.file_id END) as committed_files
|
|
343
|
-
FROM v4_tasks t
|
|
344
|
-
JOIN v4_task_file_links tfl ON t.id = tfl.task_id
|
|
345
|
-
WHERE t.status_id = ?
|
|
346
|
-
`).get(TASK_STATUS.WAITING_REVIEW);
|
|
347
|
-
|
|
348
|
-
return {
|
|
349
|
-
...existing_stats,
|
|
350
|
-
review_status: {
|
|
351
|
-
tasks_awaiting_commit: reviewStatus.awaiting_commit,
|
|
352
|
-
files_to_commit: reviewStatus.total_files - reviewStatus.committed_files,
|
|
353
|
-
commit_progress: `${reviewStatus.committed_files}/${reviewStatus.total_files}`,
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
**Acceptance Criteria**:
|
|
359
|
-
- [ ] Stats output includes `review_status` section
|
|
360
|
-
- [ ] Shows count of tasks awaiting commits
|
|
361
|
-
- [ ] Shows commit progress (files committed / total files)
|
|
362
|
-
- [ ] Query is performant (<100ms for 1000 tasks)
|
|
363
|
-
|
|
364
|
-
---
|
|
365
|
-
|
|
366
|
-
### Task 6: Configuration
|
|
367
|
-
**Priority**: Medium
|
|
368
|
-
**Layer**: Infrastructure
|
|
369
|
-
**AI Time**: 5 minutes
|
|
370
|
-
**Token Budget**: 3k-5k tokens
|
|
371
|
-
|
|
372
|
-
**Files**:
|
|
373
|
-
- `src/database.ts` (config defaults)
|
|
374
|
-
- `docs/CONFIGURATION.md`
|
|
375
|
-
|
|
376
|
-
**New Config Keys**:
|
|
377
|
-
```typescript
|
|
378
|
-
// In initializeDatabase() function
|
|
379
|
-
const configDefaults = [
|
|
380
|
-
// Existing configs...
|
|
381
|
-
|
|
382
|
-
// NEW: Git-aware auto-complete
|
|
383
|
-
{ key: 'git_auto_complete_enabled', value: '1' },
|
|
384
|
-
{ key: 'require_all_files_committed', value: '1' },
|
|
385
|
-
{ key: 'stale_review_notification_hours', value: '48' },
|
|
386
|
-
];
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
**Documentation** (CONFIGURATION.md):
|
|
390
|
-
```markdown
|
|
391
|
-
### Git-Aware Auto-Complete (v3.4.0)
|
|
392
|
-
|
|
393
|
-
| Key | Type | Default | Description |
|
|
394
|
-
|-----|------|---------|-------------|
|
|
395
|
-
| `git_auto_complete_enabled` | boolean | `1` (true) | Enable automatic completion based on Git commits |
|
|
396
|
-
| `require_all_files_committed` | boolean | `1` (true) | Require ALL watched files to be committed (vs ANY) |
|
|
397
|
-
| `stale_review_notification_hours` | number | `48` | Hours before notifying about stale review tasks |
|
|
398
|
-
|
|
399
|
-
**Examples**:
|
|
400
|
-
```typescript
|
|
401
|
-
// Disable Git auto-complete
|
|
402
|
-
config action=update key="git_auto_complete_enabled" value="0"
|
|
403
|
-
|
|
404
|
-
// Complete task when ANY file is committed (not just all)
|
|
405
|
-
config action=update key="require_all_files_committed" value="0"
|
|
406
|
-
|
|
407
|
-
// Notify about stale reviews after 72 hours
|
|
408
|
-
config action=update key="stale_review_notification_hours" value="72"
|
|
409
|
-
```
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
**Acceptance Criteria**:
|
|
413
|
-
- [ ] Config defaults added to `database.ts`
|
|
414
|
-
- [ ] Documentation added to `CONFIGURATION.md`
|
|
415
|
-
- [ ] Config values respected by `detectAndCompleteReviewedTasks()`
|
|
416
|
-
|
|
417
|
-
---
|
|
418
|
-
|
|
419
|
-
### Task 7: Documentation & Testing
|
|
420
|
-
**Priority**: High
|
|
421
|
-
**Layer**: Cross-Cutting
|
|
422
|
-
**Dependencies**: All previous tasks
|
|
423
|
-
**AI Time**: 35-40 minutes
|
|
424
|
-
**Token Budget**: 23k-32k tokens
|
|
425
|
-
|
|
426
|
-
**Documentation Files**:
|
|
427
|
-
1. `docs/TASK_OVERVIEW.md` - Update lifecycle diagram
|
|
428
|
-
2. `docs/AUTO_FILE_TRACKING.md` - Add Git-aware section
|
|
429
|
-
3. `docs/TASK_ACTIONS.md` - Update status transitions
|
|
430
|
-
4. `CHANGELOG.md` - Add v3.4.0 entry
|
|
431
|
-
|
|
432
|
-
**Test Files** (all in `src/tests/`):
|
|
433
|
-
1. `tasks.git-auto-complete.test.ts` - Comprehensive test suite
|
|
434
|
-
2. `tasks.git-integration.test.ts` - Git log integration tests
|
|
435
|
-
|
|
436
|
-
**Test Cases**:
|
|
437
|
-
```typescript
|
|
438
|
-
describe('Git-Aware Auto-Complete', () => {
|
|
439
|
-
describe('detectAndCompleteReviewedTasks', () => {
|
|
440
|
-
it('should complete task when all files committed', async () => {
|
|
441
|
-
// Test: Create task, commit all watched files, verify status=done
|
|
442
|
-
});
|
|
443
|
-
|
|
444
|
-
it('should NOT complete task when some files uncommitted', async () => {
|
|
445
|
-
// Test: Create task, commit only some files, verify status=waiting_review
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
it('should handle tasks with no watched files', async () => {
|
|
449
|
-
// Test: Create task with no files, verify no crash
|
|
450
|
-
});
|
|
451
|
-
|
|
452
|
-
it('should skip if not in Git repo', async () => {
|
|
453
|
-
// Test: Mock git log failure, verify graceful skip
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
it('should respect git_auto_complete_enabled config', async () => {
|
|
457
|
-
// Test: Disable config, verify no auto-completion
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
it('should respect require_all_files_committed config', async () => {
|
|
461
|
-
// Test: Set to false, verify completion with ANY file committed
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
it('should handle multiple tasks simultaneously', async () => {
|
|
465
|
-
// Test: 10 tasks, some committed, some not, verify correct counts
|
|
466
|
-
});
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
describe('File Watcher Integration', () => {
|
|
470
|
-
it('should trigger on .git/index change', async () => {
|
|
471
|
-
// Test: Simulate git commit, verify auto-completion
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
it('should not trigger on regular file changes', async () => {
|
|
475
|
-
// Test: Modify watched file, verify no premature completion
|
|
476
|
-
});
|
|
477
|
-
});
|
|
478
|
-
|
|
479
|
-
describe('Periodic Checks Integration', () => {
|
|
480
|
-
it('should auto-complete before task.list', async () => {
|
|
481
|
-
// Test: Call task.list, verify auto-completion runs first
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
it('should include git_auto_completed in response', async () => {
|
|
485
|
-
// Test: Verify response structure includes count
|
|
486
|
-
});
|
|
487
|
-
});
|
|
488
|
-
});
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
**Acceptance Criteria**:
|
|
492
|
-
- [ ] All documentation updated with Git-aware feature
|
|
493
|
-
- [ ] CHANGELOG.md includes comprehensive v3.4.0 entry
|
|
494
|
-
- [ ] Test suite covers all scenarios (>90% code coverage)
|
|
495
|
-
- [ ] All tests pass (`npm test`)
|
|
496
|
-
- [ ] TypeScript compiles without errors
|
|
497
|
-
|
|
498
|
-
---
|
|
499
|
-
|
|
500
|
-
## Migration Guide (v3.3.x → v3.4.0)
|
|
501
|
-
|
|
502
|
-
### Breaking Changes
|
|
503
|
-
|
|
504
|
-
**None** - v3.4.0 is fully backward-compatible.
|
|
505
|
-
|
|
506
|
-
### New Behavior
|
|
507
|
-
|
|
508
|
-
**Before (v3.3.x)**:
|
|
509
|
-
```
|
|
510
|
-
waiting_review (24h idle) → todo (auto-revert, work discarded)
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
**After (v3.4.0)**:
|
|
514
|
-
```
|
|
515
|
-
waiting_review (all files committed) → done (auto-complete, work preserved)
|
|
516
|
-
```
|
|
517
|
-
|
|
518
|
-
### Configuration
|
|
519
|
-
|
|
520
|
-
If you want to preserve the old behavior (not recommended):
|
|
521
|
-
```typescript
|
|
522
|
-
config action=update key="git_auto_complete_enabled" value="0"
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
### Recommended Workflow
|
|
526
|
-
|
|
527
|
-
1. Create task with watched files:
|
|
528
|
-
```typescript
|
|
529
|
-
task action=create
|
|
530
|
-
title: "Implement feature"
|
|
531
|
-
watch_files: ["src/feature.ts", "src/feature.test.ts"]
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
2. Implement feature (files auto-tracked)
|
|
535
|
-
- Task moves: `todo` → `in_progress`
|
|
536
|
-
|
|
537
|
-
3. Quality gates pass (if configured)
|
|
538
|
-
- Task moves: `in_progress` → `waiting_review`
|
|
539
|
-
|
|
540
|
-
4. Commit changes to Git:
|
|
541
|
-
```bash
|
|
542
|
-
git add src/feature.ts src/feature.test.ts
|
|
543
|
-
git commit -m "Implement feature"
|
|
544
|
-
```
|
|
545
|
-
|
|
546
|
-
5. **NEW**: Task auto-completes
|
|
547
|
-
- Task moves: `waiting_review` → `done`
|
|
548
|
-
- Console output: `✓ Git-aware auto-complete: 1 task completed`
|
|
549
|
-
|
|
550
|
-
## Benefits
|
|
551
|
-
|
|
552
|
-
### 1. Preserves Completed Work
|
|
553
|
-
- No more auto-revert to `todo` after 24h
|
|
554
|
-
- Git commits represent finalized work → task correctly marked `done`
|
|
555
|
-
|
|
556
|
-
### 2. Zero-Token Overhead
|
|
557
|
-
- No manual MCP calls needed to mark tasks complete
|
|
558
|
-
- Git integration happens automatically in background
|
|
559
|
-
|
|
560
|
-
### 3. Multi-Agent Compatible
|
|
561
|
-
- Any agent can commit changes
|
|
562
|
-
- All agents see the same Git state (persistent)
|
|
563
|
-
|
|
564
|
-
### 4. Survives Restarts
|
|
565
|
-
- Git history persists across process restarts
|
|
566
|
-
- Task completion state always accurate based on Git
|
|
567
|
-
|
|
568
|
-
### 5. Natural Workflow Alignment
|
|
569
|
-
- Developers already commit when work is done
|
|
570
|
-
- System aligns with existing Git-based practices
|
|
571
|
-
|
|
572
|
-
## Risks & Mitigations
|
|
573
|
-
|
|
574
|
-
### Risk 1: False Positives (Premature Completion)
|
|
575
|
-
**Scenario**: Files committed but work not actually complete
|
|
576
|
-
|
|
577
|
-
**Mitigation**:
|
|
578
|
-
- Quality gates must pass BEFORE entering `waiting_review`
|
|
579
|
-
- Git auto-complete only applies to tasks already in `waiting_review`
|
|
580
|
-
- If work incomplete, task would still be in `in_progress`
|
|
581
|
-
|
|
582
|
-
### Risk 2: Not in Git Repo
|
|
583
|
-
**Scenario**: Project not using Git
|
|
584
|
-
|
|
585
|
-
**Mitigation**:
|
|
586
|
-
- `git log` failures are caught and logged
|
|
587
|
-
- Tasks gracefully skip auto-completion if Git unavailable
|
|
588
|
-
- Config option to disable: `git_auto_complete_enabled=0`
|
|
589
|
-
|
|
590
|
-
### Risk 3: Partial Commits
|
|
591
|
-
**Scenario**: Only some watched files committed
|
|
592
|
-
|
|
593
|
-
**Mitigation**:
|
|
594
|
-
- Default: `require_all_files_committed=1` (strict mode)
|
|
595
|
-
- Alternative: Set to `0` to complete on ANY file committed
|
|
596
|
-
- Console diagnostics show which files committed vs not
|
|
597
|
-
|
|
598
|
-
### Risk 4: Performance Impact
|
|
599
|
-
**Scenario**: Running `git log` for many tasks is slow
|
|
600
|
-
|
|
601
|
-
**Mitigation**:
|
|
602
|
-
- Periodic checks only run before `list` and `stats` (not continuous)
|
|
603
|
-
- File watcher triggers only on `.git/index` change (infrequent)
|
|
604
|
-
- Git log queries use `--name-only` (minimal output)
|
|
605
|
-
- Benchmark target: <500ms for 100 tasks
|
|
606
|
-
|
|
607
|
-
## Success Metrics
|
|
608
|
-
|
|
609
|
-
### Functional Metrics
|
|
610
|
-
- [ ] Zero auto-reverts of completed work (0 `waiting_review` → `todo` transitions)
|
|
611
|
-
- [ ] >95% accuracy: Tasks marked `done` when all files committed
|
|
612
|
-
- [ ] <5% false negatives: Tasks stuck in `waiting_review` when files committed
|
|
613
|
-
|
|
614
|
-
### Performance Metrics
|
|
615
|
-
- [ ] Periodic checks: <500ms for 100 tasks
|
|
616
|
-
- [ ] File watcher: <100ms response time on `.git/index` change
|
|
617
|
-
- [ ] No performance degradation vs v3.3.x baseline
|
|
618
|
-
|
|
619
|
-
### Token Efficiency Metrics
|
|
620
|
-
- [ ] Zero MCP calls needed for task completion (100% automated)
|
|
621
|
-
- [ ] Maintain existing 70% token reduction vs decision-based tracking
|
|
622
|
-
|
|
623
|
-
## Timeline
|
|
624
|
-
|
|
625
|
-
### Phase 1: Core Implementation (Tasks 1-2)
|
|
626
|
-
**Duration**: 30-35 minutes AI time
|
|
627
|
-
**Deliverable**: `detectAndCompleteReviewedTasks()` function working
|
|
628
|
-
|
|
629
|
-
### Phase 2: Integration (Tasks 3-4)
|
|
630
|
-
**Duration**: 25-35 minutes AI time
|
|
631
|
-
**Deliverable**: Periodic checks + file watcher integration
|
|
632
|
-
|
|
633
|
-
### Phase 3: Polish & Documentation (Tasks 5-7)
|
|
634
|
-
**Duration**: 50-55 minutes AI time
|
|
635
|
-
**Deliverable**: Full documentation, tests, and enhanced UI
|
|
636
|
-
|
|
637
|
-
### Total Timeline
|
|
638
|
-
**AI Time**: 105-140 minutes (~1.75-2.5 hours)
|
|
639
|
-
**Token Budget**: 69k-100k tokens
|
|
640
|
-
|
|
641
|
-
## Related Documents
|
|
642
|
-
|
|
643
|
-
- [AUTO_FILE_TRACKING.md](./AUTO_FILE_TRACKING.md) - File watcher system overview
|
|
644
|
-
- [TASK_OVERVIEW.md](./TASK_OVERVIEW.md) - Task lifecycle and status transitions
|
|
645
|
-
- [CONFIGURATION.md](./CONFIGURATION.md) - Configuration options
|
|
646
|
-
- [WORKFLOWS.md](./WORKFLOWS.md) - Multi-agent coordination patterns
|