agent-tasks 1.6.5 → 1.6.7

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/README.md CHANGED
@@ -1,181 +1,181 @@
1
- # agent-tasks
2
-
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
4
- [![Node.js](https://img.shields.io/badge/node-%3E%3D20.11-brightgreen)](https://nodejs.org/)
5
- [![Tests](https://img.shields.io/badge/tests-337%20passing-brightgreen)]()
6
- [![MCP Tools](https://img.shields.io/badge/MCP%20tools-31-purple)]()
7
- [![REST Endpoints](https://img.shields.io/badge/REST-19%20endpoints-orange)]()
8
-
9
- **Pipeline-driven task management for AI coding agents.** An [MCP](https://modelcontextprotocol.io/) server with stage-gated pipelines, multi-agent collaboration, and a real-time kanban dashboard. Tasks flow through configurable stages — `backlog`, `spec`, `plan`, `implement`, `test`, `review`, `done` — with dependency tracking, approval workflows, artifact versioning, and threaded comments.
10
-
11
- Built for AI coding agents (Claude Code, Codex CLI, Gemini CLI, Aider) but works equally well with any MCP client, REST consumer, or WebSocket listener.
12
-
13
- ---
14
-
15
- | Light Theme | Dark Theme |
16
- | -------------------------------------------------------- | ------------------------------------------------------ |
17
- | ![Light mode dashboard](docs/assets/dashboard-light.png) | ![Dark mode dashboard](docs/assets/dashboard-dark.png) |
18
-
19
- ---
20
-
21
- ## Why agent-tasks?
22
-
23
- When you run multiple AI agents on the same codebase, they need a shared task pipeline — not just a flat todo list. They need stages, dependencies, approvals, and visibility.
24
-
25
- ---
26
-
27
- ## Features
28
-
29
- - **Pipeline stages** — configurable per project: `backlog` > `spec` > `plan` > `implement` > `test` > `review` > `done`
30
- - **Task dependencies** — DAG with automatic cycle detection; blocks advancement until resolved
31
- - **Approval workflows** — stage-gated approve/reject with auto-regress on rejection
32
- - **Multi-agent collaboration** — roles (collaborator, reviewer, watcher), claiming, assignment
33
- - **Subtask hierarchies** — parent/child task trees with progress tracking
34
- - **Threaded comments** — async discussions between agents on any task
35
- - **Artifact versioning** — per-stage document attachments with automatic versioning and diff viewer
36
- - **Full-text search** — FTS5 search across task titles and descriptions
37
- - **Real-time kanban dashboard** — drag-and-drop, side panel, inline creation, dark/light theme
38
- - **3 transport layers** — MCP (stdio), REST API (HTTP), WebSocket (real-time events)
39
- - **TodoWrite bridge** — intercepts Claude Code's built-in TodoWrite and syncs to the pipeline
40
- - **Task cleanup hooks** — auto-fails orphaned tasks on session stop and cleans up stale tasks on session start
41
- - **Agent bridge** — notifies connected agents on task events
42
-
43
- ---
44
-
45
- ## Quick Start
46
-
47
- ### Install from npm
48
-
49
- ```bash
50
- npm install -g agent-tasks
51
- ```
52
-
53
- ### Or clone from source
54
-
55
- ```bash
56
- git clone https://github.com/keshrath/agent-tasks.git
57
- cd agent-tasks
58
- npm install
59
- npm run build
60
- ```
61
-
62
- ### Option 1: MCP server (for AI agents)
63
-
64
- Add to your MCP client config (Claude Code, Cline, etc.):
65
-
66
- ```json
67
- {
68
- "mcpServers": {
69
- "agent-tasks": {
70
- "command": "npx",
71
- "args": ["agent-tasks"]
72
- }
73
- }
74
- }
75
- ```
76
-
77
- The dashboard auto-starts at http://localhost:3422 on the first MCP connection.
78
-
79
- ### Option 2: Standalone server (for REST/WebSocket clients)
80
-
81
- ```bash
82
- node dist/server.js --port 3422
83
- ```
84
-
85
- ---
86
-
87
- ## Claude Code Integration
88
-
89
- Add agent-tasks as an MCP server in `~/.claude/settings.json`:
90
-
91
- ```json
92
- {
93
- "mcpServers": {
94
- "agent-tasks": {
95
- "command": "node",
96
- "args": ["/path/to/agent-tasks/dist/index.js"]
97
- }
98
- }
99
- }
100
- ```
101
-
102
- Once configured, Claude Code can use all 31 MCP tools directly — creating tasks, advancing stages, adding artifacts, commenting, and more. See the [Setup Guide](docs/SETUP.md) for detailed integration steps.
103
-
104
- ---
105
-
106
- ## MCP Tools (33)
107
-
108
- | Category | Tools |
109
- | ----------------------- | ----------------------------------------------------------------------------------------------------------- |
110
- | **Task lifecycle** (12) | `task_create`, `task_list`, `task_next`, `task_claim`, `task_advance`, `task_regress`, `task_complete`, ... |
111
- | **Subtasks & deps** (4) | `task_expand`, `task_get_subtasks`, `task_add_dependency`, `task_remove_dependency` |
112
- | **Artifacts** (2) | `task_add_artifact`, `task_get_artifacts` |
113
- | **Comments** (2) | `task_comment`, `task_get_comments` |
114
- | **Collaboration** (2) | `task_add_collaborator`, `task_remove_collaborator` |
115
- | **Approvals** (5) | `task_request_approval`, `task_approve`, `task_reject`, `task_pending_approvals`, `task_review_cycle` |
116
- | **Config & utils** (4) | `task_pipeline_config`, `task_set_session`, `task_cleanup`, `task_generate_rules` |
117
-
118
- See [full API reference](docs/API.md) for detailed descriptions of every tool and endpoint.
119
-
120
- ## REST API (19 endpoints)
121
-
122
- All endpoints return JSON. CORS enabled. See [full API reference](docs/API.md#rest-api-18-endpoints) for details.
123
-
124
- ```
125
- GET /health Health check with version + uptime
126
- GET /api/tasks List tasks (status, stage, project, assignee filters)
127
- GET /api/tasks/:id Get a single task
128
- GET /api/tasks/:id/subtasks Subtasks of a parent
129
- GET /api/tasks/:id/artifacts Artifacts (filter by stage)
130
- GET /api/tasks/:id/comments Comments on a task
131
- GET /api/tasks/:id/dependencies Dependencies for a task
132
- GET /api/dependencies All dependencies across all tasks
133
- GET /api/pipeline Pipeline stage configuration
134
- GET /api/overview Full state dump
135
- GET /api/agents Online agents
136
- GET /api/search?q= Full-text search
137
-
138
- POST /api/tasks Create a new task
139
- PUT /api/tasks/:id Update task fields
140
- PUT /api/tasks/:id/stage Change stage (advance or regress)
141
- POST /api/tasks/:id/comments Add a comment
142
- POST /api/cleanup Trigger manual cleanup
143
- ```
144
-
145
- ---
146
-
147
- ## Testing
148
-
149
- ```bash
150
- npm test # 337 tests across 12 suites
151
- npm run test:watch # Watch mode
152
- npm run test:coverage # Coverage report
153
- npm run check # Full CI: typecheck + lint + format + test
154
- ```
155
-
156
- ---
157
-
158
- ## Environment variables
159
-
160
- | Variable | Default | Description |
161
- | -------------------------- | ------------------------------- | ---------------------------------------------------- |
162
- | `AGENT_TASKS_DB` | `~/.agent-tasks/agent-tasks.db` | SQLite database file path |
163
- | `AGENT_TASKS_PORT` | `3422` | Dashboard HTTP/WebSocket port |
164
- | `AGENT_TASKS_INSTRUCTIONS` | enabled | Set to `0` to disable response-embedded instructions |
165
- | `AGENT_COMM_URL` | `http://localhost:3421` | Agent-comm REST URL for bridge notifications |
166
-
167
- ---
168
-
169
- ## Documentation
170
-
171
- - [API Reference](docs/API.md) — all 31 MCP tools, 19 REST endpoints, WebSocket protocol
172
- - [Architecture](docs/ARCHITECTURE.md) — source structure, design principles, database schema
173
- - [Dashboard](docs/DASHBOARD.md) — kanban board features, keyboard shortcuts, screenshots
174
- - [Setup Guide](docs/SETUP.md) — installation, client setup (Claude Code, OpenCode, Cursor, Windsurf), hooks
175
- - [Changelog](CHANGELOG.md)
176
-
177
- ---
178
-
179
- ## License
180
-
181
- MIT — see [LICENSE](LICENSE)
1
+ # agent-tasks
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
4
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20.11-brightgreen)](https://nodejs.org/)
5
+ [![Tests](https://img.shields.io/badge/tests-337%20passing-brightgreen)]()
6
+ [![MCP Tools](https://img.shields.io/badge/MCP%20tools-31-purple)]()
7
+ [![REST Endpoints](https://img.shields.io/badge/REST-19%20endpoints-orange)]()
8
+
9
+ **Pipeline-driven task management for AI coding agents.** An [MCP](https://modelcontextprotocol.io/) server with stage-gated pipelines, multi-agent collaboration, and a real-time kanban dashboard. Tasks flow through configurable stages — `backlog`, `spec`, `plan`, `implement`, `test`, `review`, `done` — with dependency tracking, approval workflows, artifact versioning, and threaded comments.
10
+
11
+ Built for AI coding agents (Claude Code, Codex CLI, Gemini CLI, Aider) but works equally well with any MCP client, REST consumer, or WebSocket listener.
12
+
13
+ ---
14
+
15
+ | Light Theme | Dark Theme |
16
+ | -------------------------------------------------------- | ------------------------------------------------------ |
17
+ | ![Light mode dashboard](docs/assets/dashboard-light.png) | ![Dark mode dashboard](docs/assets/dashboard-dark.png) |
18
+
19
+ ---
20
+
21
+ ## Why agent-tasks?
22
+
23
+ When you run multiple AI agents on the same codebase, they need a shared task pipeline — not just a flat todo list. They need stages, dependencies, approvals, and visibility.
24
+
25
+ ---
26
+
27
+ ## Features
28
+
29
+ - **Pipeline stages** — configurable per project: `backlog` > `spec` > `plan` > `implement` > `test` > `review` > `done`
30
+ - **Task dependencies** — DAG with automatic cycle detection; blocks advancement until resolved
31
+ - **Approval workflows** — stage-gated approve/reject with auto-regress on rejection
32
+ - **Multi-agent collaboration** — roles (collaborator, reviewer, watcher), claiming, assignment
33
+ - **Subtask hierarchies** — parent/child task trees with progress tracking
34
+ - **Threaded comments** — async discussions between agents on any task
35
+ - **Artifact versioning** — per-stage document attachments with automatic versioning and diff viewer
36
+ - **Full-text search** — FTS5 search across task titles and descriptions
37
+ - **Real-time kanban dashboard** — drag-and-drop, side panel, inline creation, dark/light theme
38
+ - **3 transport layers** — MCP (stdio), REST API (HTTP), WebSocket (real-time events)
39
+ - **TodoWrite bridge** — intercepts Claude Code's built-in TodoWrite and syncs to the pipeline
40
+ - **Task cleanup hooks** — auto-fails orphaned tasks on session stop and cleans up stale tasks on session start
41
+ - **Agent bridge** — notifies connected agents on task events
42
+
43
+ ---
44
+
45
+ ## Quick Start
46
+
47
+ ### Install from npm
48
+
49
+ ```bash
50
+ npm install -g agent-tasks
51
+ ```
52
+
53
+ ### Or clone from source
54
+
55
+ ```bash
56
+ git clone https://github.com/keshrath/agent-tasks.git
57
+ cd agent-tasks
58
+ npm install
59
+ npm run build
60
+ ```
61
+
62
+ ### Option 1: MCP server (for AI agents)
63
+
64
+ Add to your MCP client config (Claude Code, Cline, etc.):
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "agent-tasks": {
70
+ "command": "npx",
71
+ "args": ["agent-tasks"]
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ The dashboard auto-starts at http://localhost:3422 on the first MCP connection.
78
+
79
+ ### Option 2: Standalone server (for REST/WebSocket clients)
80
+
81
+ ```bash
82
+ node dist/server.js --port 3422
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Claude Code Integration
88
+
89
+ Add agent-tasks as an MCP server in `~/.claude/settings.json`:
90
+
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "agent-tasks": {
95
+ "command": "node",
96
+ "args": ["/path/to/agent-tasks/dist/index.js"]
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ Once configured, Claude Code can use all 31 MCP tools directly — creating tasks, advancing stages, adding artifacts, commenting, and more. See the [Setup Guide](docs/SETUP.md) for detailed integration steps.
103
+
104
+ ---
105
+
106
+ ## MCP Tools (33)
107
+
108
+ | Category | Tools |
109
+ | ----------------------- | ----------------------------------------------------------------------------------------------------------- |
110
+ | **Task lifecycle** (12) | `task_create`, `task_list`, `task_next`, `task_claim`, `task_advance`, `task_regress`, `task_complete`, ... |
111
+ | **Subtasks & deps** (4) | `task_expand`, `task_get_subtasks`, `task_add_dependency`, `task_remove_dependency` |
112
+ | **Artifacts** (2) | `task_add_artifact`, `task_get_artifacts` |
113
+ | **Comments** (2) | `task_comment`, `task_get_comments` |
114
+ | **Collaboration** (2) | `task_add_collaborator`, `task_remove_collaborator` |
115
+ | **Approvals** (5) | `task_request_approval`, `task_approve`, `task_reject`, `task_pending_approvals`, `task_review_cycle` |
116
+ | **Config & utils** (4) | `task_pipeline_config`, `task_set_session`, `task_cleanup`, `task_generate_rules` |
117
+
118
+ See [full API reference](docs/API.md) for detailed descriptions of every tool and endpoint.
119
+
120
+ ## REST API (19 endpoints)
121
+
122
+ All endpoints return JSON. CORS enabled. See [full API reference](docs/API.md#rest-api-18-endpoints) for details.
123
+
124
+ ```
125
+ GET /health Health check with version + uptime
126
+ GET /api/tasks List tasks (status, stage, project, assignee filters)
127
+ GET /api/tasks/:id Get a single task
128
+ GET /api/tasks/:id/subtasks Subtasks of a parent
129
+ GET /api/tasks/:id/artifacts Artifacts (filter by stage)
130
+ GET /api/tasks/:id/comments Comments on a task
131
+ GET /api/tasks/:id/dependencies Dependencies for a task
132
+ GET /api/dependencies All dependencies across all tasks
133
+ GET /api/pipeline Pipeline stage configuration
134
+ GET /api/overview Full state dump
135
+ GET /api/agents Online agents
136
+ GET /api/search?q= Full-text search
137
+
138
+ POST /api/tasks Create a new task
139
+ PUT /api/tasks/:id Update task fields
140
+ PUT /api/tasks/:id/stage Change stage (advance or regress)
141
+ POST /api/tasks/:id/comments Add a comment
142
+ POST /api/cleanup Trigger manual cleanup
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Testing
148
+
149
+ ```bash
150
+ npm test # 337 tests across 12 suites
151
+ npm run test:watch # Watch mode
152
+ npm run test:coverage # Coverage report
153
+ npm run check # Full CI: typecheck + lint + format + test
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Environment variables
159
+
160
+ | Variable | Default | Description |
161
+ | -------------------------- | ------------------------------- | ---------------------------------------------------- |
162
+ | `AGENT_TASKS_DB` | `~/.agent-tasks/agent-tasks.db` | SQLite database file path |
163
+ | `AGENT_TASKS_PORT` | `3422` | Dashboard HTTP/WebSocket port |
164
+ | `AGENT_TASKS_INSTRUCTIONS` | enabled | Set to `0` to disable response-embedded instructions |
165
+ | `AGENT_COMM_URL` | `http://localhost:3421` | Agent-comm REST URL for bridge notifications |
166
+
167
+ ---
168
+
169
+ ## Documentation
170
+
171
+ - [API Reference](docs/API.md) — all 31 MCP tools, 19 REST endpoints, WebSocket protocol
172
+ - [Architecture](docs/ARCHITECTURE.md) — source structure, design principles, database schema
173
+ - [Dashboard](docs/DASHBOARD.md) — kanban board features, keyboard shortcuts, screenshots
174
+ - [Setup Guide](docs/SETUP.md) — installation, client setup (Claude Code, OpenCode, Cursor, Windsurf), hooks
175
+ - [Changelog](CHANGELOG.md)
176
+
177
+ ---
178
+
179
+ ## License
180
+
181
+ MIT — see [LICENSE](LICENSE)
@@ -12,56 +12,56 @@ export function generateRules(format, stages, project) {
12
12
  }
13
13
  function generateMdc(stages, project) {
14
14
  const projectLine = project ? `\nProject: ${project}` : '';
15
- return `---
16
- description: Pipeline task management workflow for AI agents
17
- alwaysApply: true
18
- ---
19
-
20
- # Pipeline Workflow${projectLine}
21
-
22
- ## Task Lifecycle
23
-
24
- Tasks flow through stages: ${stages.filter((s) => s !== 'cancelled').join(' → ')}
25
-
26
- ## Rules
27
-
28
- 1. **Always check for work first**: Call \`task_next\` to find available tasks
29
- 2. **Claim before working**: Call \`task_claim\` before starting implementation
30
- 3. **Advance through stages**: Use \`task_advance\` — never skip stages
31
- 4. **Attach artifacts**: Use \`task_add_artifact\` at each stage (specs, plans, test results, review notes)
32
- 5. **Comment on decisions**: Use \`task_comment\` to record reasoning and tradeoffs
33
- 6. **Complete with results**: Use \`task_complete\` with a summary of what was done
34
- 7. **Create subtasks**: Break large tasks into subtasks with \`task_create\` using \`parent_id\`
35
-
36
- ## Available Tools
37
-
38
- - \`task_create\` — Create a task (title, description, priority, project, tags, parent_id)
39
- - \`task_list\` — List tasks (filter by status, stage, project, assignee)
40
- - \`task_claim\` — Claim and start working on a task
41
- - \`task_advance\` — Move to next stage (checks dependencies)
42
- - \`task_complete\` — Mark done with result
43
- - \`task_add_artifact\` — Attach spec/plan/test results/review notes
44
- - \`task_comment\` — Add discussion comment
45
- - \`task_search\` — Full-text search across tasks
46
- - \`task_next\` — Get highest-priority unblocked task
47
- - \`task_review_cycle\` — Approve or reject during review
15
+ return `---
16
+ description: Pipeline task management workflow for AI agents
17
+ alwaysApply: true
18
+ ---
19
+
20
+ # Pipeline Workflow${projectLine}
21
+
22
+ ## Task Lifecycle
23
+
24
+ Tasks flow through stages: ${stages.filter((s) => s !== 'cancelled').join(' → ')}
25
+
26
+ ## Rules
27
+
28
+ 1. **Always check for work first**: Call \`task_next\` to find available tasks
29
+ 2. **Claim before working**: Call \`task_claim\` before starting implementation
30
+ 3. **Advance through stages**: Use \`task_advance\` — never skip stages
31
+ 4. **Attach artifacts**: Use \`task_add_artifact\` at each stage (specs, plans, test results, review notes)
32
+ 5. **Comment on decisions**: Use \`task_comment\` to record reasoning and tradeoffs
33
+ 6. **Complete with results**: Use \`task_complete\` with a summary of what was done
34
+ 7. **Create subtasks**: Break large tasks into subtasks with \`task_create\` using \`parent_id\`
35
+
36
+ ## Available Tools
37
+
38
+ - \`task_create\` — Create a task (title, description, priority, project, tags, parent_id)
39
+ - \`task_list\` — List tasks (filter by status, stage, project, assignee)
40
+ - \`task_claim\` — Claim and start working on a task
41
+ - \`task_advance\` — Move to next stage (checks dependencies)
42
+ - \`task_complete\` — Mark done with result
43
+ - \`task_add_artifact\` — Attach spec/plan/test results/review notes
44
+ - \`task_comment\` — Add discussion comment
45
+ - \`task_search\` — Full-text search across tasks
46
+ - \`task_next\` — Get highest-priority unblocked task
47
+ - \`task_review_cycle\` — Approve or reject during review
48
48
  `;
49
49
  }
50
50
  function generateClaudeMd(stages, project) {
51
51
  const projectLine = project ? ` for project "${project}"` : '';
52
- return `## Pipeline Tasks${projectLine}
53
-
54
- Tasks flow through: ${stages.filter((s) => s !== 'cancelled').join(' → ')}
55
-
56
- ### Workflow
57
- 1. Check \`task_next\` for available work
58
- 2. \`task_claim\` before starting
59
- 3. \`task_advance\` through stages — attach artifacts at each stage
60
- 4. \`task_comment\` to record decisions
61
- 5. \`task_complete\` with summary
62
-
63
- ### Key Tools
64
- \`task_create\`, \`task_list\`, \`task_claim\`, \`task_advance\`, \`task_complete\`, \`task_add_artifact\`, \`task_comment\`, \`task_search\`, \`task_next\`, \`task_review_cycle\`
52
+ return `## Pipeline Tasks${projectLine}
53
+
54
+ Tasks flow through: ${stages.filter((s) => s !== 'cancelled').join(' → ')}
55
+
56
+ ### Workflow
57
+ 1. Check \`task_next\` for available work
58
+ 2. \`task_claim\` before starting
59
+ 3. \`task_advance\` through stages — attach artifacts at each stage
60
+ 4. \`task_comment\` to record decisions
61
+ 5. \`task_complete\` with summary
62
+
63
+ ### Key Tools
64
+ \`task_create\`, \`task_list\`, \`task_claim\`, \`task_advance\`, \`task_complete\`, \`task_add_artifact\`, \`task_comment\`, \`task_search\`, \`task_next\`, \`task_review_cycle\`
65
65
  `;
66
66
  }
67
67
  //# sourceMappingURL=rules.js.map
@@ -64,7 +64,7 @@ export class TaskService {
64
64
  seen.add(s);
65
65
  }
66
66
  const json = JSON.stringify(stages);
67
- this.db.run(`INSERT INTO pipeline_config (project, stages, updated_at) VALUES (?, ?, datetime('now'))
67
+ this.db.run(`INSERT INTO pipeline_config (project, stages, updated_at) VALUES (?, ?, datetime('now'))
68
68
  ON CONFLICT(project) DO UPDATE SET stages = ?, updated_at = datetime('now')`, [project, json, json]);
69
69
  this.events.emit('pipeline:configured', { project, stages });
70
70
  return this.db.queryOne('SELECT * FROM pipeline_config WHERE project = ?', [
@@ -88,7 +88,7 @@ export class TaskService {
88
88
  const effectiveStage = input.stage || stages[0];
89
89
  this.validateStage(effectiveStage, stages);
90
90
  const status = syncStatusForStage(effectiveStage, stages);
91
- const result = this.db.run(`INSERT INTO tasks (title, description, created_by, assigned_to, status, stage, priority, project, tags, parent_id)
91
+ const result = this.db.run(`INSERT INTO tasks (title, description, created_by, assigned_to, status, stage, priority, project, tags, parent_id)
92
92
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
93
93
  input.title.trim(),
94
94
  input.description?.trim() ?? null,
@@ -377,10 +377,10 @@ export class TaskService {
377
377
  sql += ' AND t.stage = ?';
378
378
  params.push(stage);
379
379
  }
380
- sql += ` AND NOT EXISTS (
381
- SELECT 1 FROM task_dependencies d
382
- JOIN tasks dep ON dep.id = d.depends_on
383
- WHERE d.task_id = t.id AND d.relationship = 'blocks' AND dep.status NOT IN ('completed', 'cancelled', 'failed')
380
+ sql += ` AND NOT EXISTS (
381
+ SELECT 1 FROM task_dependencies d
382
+ JOIN tasks dep ON dep.id = d.depends_on
383
+ WHERE d.task_id = t.id AND d.relationship = 'blocks' AND dep.status NOT IN ('completed', 'cancelled', 'failed')
384
384
  )`;
385
385
  sql += ' ORDER BY t.priority DESC, t.created_at ASC LIMIT 1';
386
386
  return this.db.queryOne(sql, params);
@@ -489,11 +489,11 @@ export class TaskService {
489
489
  const sanitized = this.sanitizeFtsQuery(query);
490
490
  if (!sanitized)
491
491
  return [];
492
- let sql = `
493
- SELECT t.*, snippet(tasks_fts, 0, '<mark>', '</mark>', '...', 32) as snippet,
494
- rank
495
- FROM tasks_fts
496
- JOIN tasks t ON t.id = tasks_fts.rowid
492
+ let sql = `
493
+ SELECT t.*, snippet(tasks_fts, 0, '<mark>', '</mark>', '...', 32) as snippet,
494
+ rank
495
+ FROM tasks_fts
496
+ JOIN tasks t ON t.id = tasks_fts.rowid
497
497
  WHERE tasks_fts MATCH ?`;
498
498
  const params = [sanitized];
499
499
  if (options?.project) {
@@ -519,7 +519,7 @@ export class TaskService {
519
519
  return cleaned
520
520
  .split(/\s+/)
521
521
  .filter((w) => w.length > 0)
522
- .map((w) => `"${w}"`)
522
+ .map((w) => '"' + w.replace(/"/g, '""') + '"')
523
523
  .join(' ');
524
524
  }
525
525
  // ---- Delete ----
@@ -617,7 +617,7 @@ export class TaskService {
617
617
  }
618
618
  }
619
619
  checkDependencies(taskId) {
620
- const blockers = this.db.queryAll(`SELECT t.* FROM tasks t JOIN task_dependencies d ON t.id = d.depends_on
620
+ const blockers = this.db.queryAll(`SELECT t.* FROM tasks t JOIN task_dependencies d ON t.id = d.depends_on
621
621
  WHERE d.task_id = ? AND d.relationship = 'blocks' AND t.status NOT IN ('completed', 'cancelled', 'failed')`, [taskId]);
622
622
  if (blockers.length > 0) {
623
623
  const names = blockers.map((b) => `#${b.id} "${b.title}" (${b.stage})`).join(', ');