@claude-flow/cli 3.0.0-alpha.13 → 3.0.0-alpha.14
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/package.json +12 -4
- package/.agentic-flow/intelligence.json +0 -17
- package/.claude-flow/agents/store.json +0 -16
- package/.claude-flow/daemon-state.json +0 -123
- package/.claude-flow/daemon-test.log +0 -0
- package/.claude-flow/daemon.log +0 -0
- package/.claude-flow/daemon2.log +0 -0
- package/.claude-flow/daemon3.log +0 -0
- package/.claude-flow/hive-mind/state.json +0 -51
- package/.claude-flow/metrics/agent-metrics.json +0 -1
- package/.claude-flow/metrics/codebase-map.json +0 -11
- package/.claude-flow/metrics/consolidation.json +0 -6
- package/.claude-flow/metrics/performance.json +0 -87
- package/.claude-flow/metrics/security-audit.json +0 -10
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/.claude-flow/metrics/test-gaps.json +0 -6
- package/__tests__/README.md +0 -140
- package/__tests__/TEST_SUMMARY.md +0 -144
- package/__tests__/cli.test.ts +0 -558
- package/__tests__/commands.test.ts +0 -726
- package/__tests__/config-adapter.test.ts +0 -362
- package/__tests__/config-loading.test.ts +0 -106
- package/__tests__/coverage/.tmp/coverage-0.json +0 -1
- package/__tests__/coverage/.tmp/coverage-1.json +0 -1
- package/__tests__/coverage/.tmp/coverage-2.json +0 -1
- package/__tests__/coverage/.tmp/coverage-3.json +0 -1
- package/__tests__/coverage/.tmp/coverage-4.json +0 -1
- package/__tests__/coverage/.tmp/coverage-5.json +0 -1
- package/__tests__/mcp-client.test.ts +0 -480
- package/__tests__/p1-commands.test.ts +0 -1064
- package/agents/architect.yaml +0 -11
- package/agents/coder.yaml +0 -11
- package/agents/reviewer.yaml +0 -10
- package/agents/security-architect.yaml +0 -10
- package/agents/tester.yaml +0 -10
- package/docs/CONFIG_LOADING.md +0 -236
- package/docs/IMPLEMENTATION_COMPLETE.md +0 -421
- package/docs/MCP_CLIENT_GUIDE.md +0 -620
- package/docs/REFACTORING_SUMMARY.md +0 -247
- package/scripts/publish.sh +0 -46
- package/src/commands/agent.ts +0 -955
- package/src/commands/claims.ts +0 -317
- package/src/commands/completions.ts +0 -558
- package/src/commands/config.ts +0 -452
- package/src/commands/daemon.ts +0 -621
- package/src/commands/deployment.ts +0 -323
- package/src/commands/doctor.ts +0 -382
- package/src/commands/embeddings.ts +0 -686
- package/src/commands/hive-mind.ts +0 -928
- package/src/commands/hooks.ts +0 -2603
- package/src/commands/index.ts +0 -154
- package/src/commands/init.ts +0 -597
- package/src/commands/mcp.ts +0 -753
- package/src/commands/memory.ts +0 -1161
- package/src/commands/migrate.ts +0 -447
- package/src/commands/neural.ts +0 -253
- package/src/commands/performance.ts +0 -292
- package/src/commands/plugins.ts +0 -316
- package/src/commands/process.ts +0 -695
- package/src/commands/providers.ts +0 -259
- package/src/commands/security.ts +0 -288
- package/src/commands/session.ts +0 -891
- package/src/commands/start.ts +0 -457
- package/src/commands/status.ts +0 -736
- package/src/commands/swarm.ts +0 -648
- package/src/commands/task.ts +0 -792
- package/src/commands/workflow.ts +0 -742
- package/src/config-adapter.ts +0 -210
- package/src/index.ts +0 -443
- package/src/infrastructure/in-memory-repositories.ts +0 -310
- package/src/init/claudemd-generator.ts +0 -631
- package/src/init/executor.ts +0 -762
- package/src/init/helpers-generator.ts +0 -628
- package/src/init/index.ts +0 -60
- package/src/init/mcp-generator.ts +0 -83
- package/src/init/settings-generator.ts +0 -284
- package/src/init/statusline-generator.ts +0 -211
- package/src/init/types.ts +0 -447
- package/src/mcp-client.ts +0 -241
- package/src/mcp-server.ts +0 -577
- package/src/mcp-tools/agent-tools.ts +0 -466
- package/src/mcp-tools/config-tools.ts +0 -370
- package/src/mcp-tools/hive-mind-tools.ts +0 -521
- package/src/mcp-tools/hooks-tools.ts +0 -1888
- package/src/mcp-tools/index.ts +0 -16
- package/src/mcp-tools/memory-tools.ts +0 -270
- package/src/mcp-tools/session-tools.ts +0 -359
- package/src/mcp-tools/swarm-tools.ts +0 -105
- package/src/mcp-tools/task-tools.ts +0 -347
- package/src/mcp-tools/types.ts +0 -33
- package/src/mcp-tools/workflow-tools.ts +0 -573
- package/src/output.ts +0 -639
- package/src/parser.ts +0 -417
- package/src/prompt.ts +0 -619
- package/src/services/index.ts +0 -15
- package/src/services/worker-daemon.ts +0 -726
- package/src/suggest.ts +0 -245
- package/src/types.ts +0 -287
- package/tmp.json +0 -0
- package/tsconfig.json +0 -16
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -13
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Swarm MCP Tools for CLI
|
|
3
|
-
*
|
|
4
|
-
* Tool definitions for swarm coordination.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import type { MCPTool } from './types.js';
|
|
8
|
-
|
|
9
|
-
export const swarmTools: MCPTool[] = [
|
|
10
|
-
{
|
|
11
|
-
name: 'swarm/init',
|
|
12
|
-
description: 'Initialize a swarm',
|
|
13
|
-
category: 'swarm',
|
|
14
|
-
inputSchema: {
|
|
15
|
-
type: 'object',
|
|
16
|
-
properties: {
|
|
17
|
-
topology: { type: 'string', description: 'Swarm topology type' },
|
|
18
|
-
maxAgents: { type: 'number', description: 'Maximum number of agents' },
|
|
19
|
-
config: { type: 'object', description: 'Swarm configuration' },
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
handler: async (input) => {
|
|
23
|
-
const topology = input.topology || 'hierarchical-mesh';
|
|
24
|
-
const maxAgents = input.maxAgents || 15;
|
|
25
|
-
const config = (input.config || {}) as Record<string, unknown>;
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
success: true,
|
|
29
|
-
swarmId: `swarm-${Date.now()}`,
|
|
30
|
-
topology,
|
|
31
|
-
initializedAt: new Date().toISOString(),
|
|
32
|
-
config: {
|
|
33
|
-
topology,
|
|
34
|
-
maxAgents,
|
|
35
|
-
currentAgents: 0,
|
|
36
|
-
communicationProtocol: (config.communicationProtocol as string) || 'message-bus',
|
|
37
|
-
autoScaling: (config.autoScaling as boolean) ?? true,
|
|
38
|
-
consensusMechanism: (config.consensusMechanism as string) || 'majority',
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'swarm/status',
|
|
45
|
-
description: 'Get swarm status',
|
|
46
|
-
category: 'swarm',
|
|
47
|
-
inputSchema: {
|
|
48
|
-
type: 'object',
|
|
49
|
-
properties: {
|
|
50
|
-
swarmId: { type: 'string', description: 'Swarm ID' },
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
handler: async (input) => {
|
|
54
|
-
return {
|
|
55
|
-
swarmId: input.swarmId,
|
|
56
|
-
status: 'running',
|
|
57
|
-
agentCount: 0,
|
|
58
|
-
taskCount: 0,
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: 'swarm/shutdown',
|
|
64
|
-
description: 'Shutdown a swarm',
|
|
65
|
-
category: 'swarm',
|
|
66
|
-
inputSchema: {
|
|
67
|
-
type: 'object',
|
|
68
|
-
properties: {
|
|
69
|
-
swarmId: { type: 'string', description: 'Swarm ID' },
|
|
70
|
-
graceful: { type: 'boolean', description: 'Graceful shutdown' },
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
handler: async (input) => {
|
|
74
|
-
return {
|
|
75
|
-
success: true,
|
|
76
|
-
swarmId: input.swarmId,
|
|
77
|
-
terminated: true,
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: 'swarm/health',
|
|
83
|
-
description: 'Check swarm health status',
|
|
84
|
-
category: 'swarm',
|
|
85
|
-
inputSchema: {
|
|
86
|
-
type: 'object',
|
|
87
|
-
properties: {
|
|
88
|
-
swarmId: { type: 'string', description: 'Swarm ID to check' },
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
handler: async (input) => {
|
|
92
|
-
return {
|
|
93
|
-
status: 'healthy' as const,
|
|
94
|
-
swarmId: input.swarmId || 'default',
|
|
95
|
-
checks: [
|
|
96
|
-
{ name: 'coordinator', status: 'ok', message: 'Coordinator responding' },
|
|
97
|
-
{ name: 'agents', status: 'ok', message: 'Agent pool healthy' },
|
|
98
|
-
{ name: 'memory', status: 'ok', message: 'Memory backend connected' },
|
|
99
|
-
{ name: 'messaging', status: 'ok', message: 'Message bus active' },
|
|
100
|
-
],
|
|
101
|
-
checkedAt: new Date().toISOString(),
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
];
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task MCP Tools for CLI
|
|
3
|
-
*
|
|
4
|
-
* Tool definitions for task management with file persistence.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
8
|
-
import { join } from 'node:path';
|
|
9
|
-
import type { MCPTool } from './types.js';
|
|
10
|
-
|
|
11
|
-
// Storage paths
|
|
12
|
-
const STORAGE_DIR = '.claude-flow';
|
|
13
|
-
const TASK_DIR = 'tasks';
|
|
14
|
-
const TASK_FILE = 'store.json';
|
|
15
|
-
|
|
16
|
-
interface TaskRecord {
|
|
17
|
-
taskId: string;
|
|
18
|
-
type: string;
|
|
19
|
-
description: string;
|
|
20
|
-
priority: 'low' | 'normal' | 'high' | 'critical';
|
|
21
|
-
status: 'pending' | 'in_progress' | 'completed' | 'failed' | 'cancelled';
|
|
22
|
-
progress: number;
|
|
23
|
-
assignedTo: string[];
|
|
24
|
-
tags: string[];
|
|
25
|
-
createdAt: string;
|
|
26
|
-
startedAt: string | null;
|
|
27
|
-
completedAt: string | null;
|
|
28
|
-
result?: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface TaskStore {
|
|
32
|
-
tasks: Record<string, TaskRecord>;
|
|
33
|
-
version: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function getTaskDir(): string {
|
|
37
|
-
return join(process.cwd(), STORAGE_DIR, TASK_DIR);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function getTaskPath(): string {
|
|
41
|
-
return join(getTaskDir(), TASK_FILE);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function ensureTaskDir(): void {
|
|
45
|
-
const dir = getTaskDir();
|
|
46
|
-
if (!existsSync(dir)) {
|
|
47
|
-
mkdirSync(dir, { recursive: true });
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function loadTaskStore(): TaskStore {
|
|
52
|
-
try {
|
|
53
|
-
const path = getTaskPath();
|
|
54
|
-
if (existsSync(path)) {
|
|
55
|
-
const data = readFileSync(path, 'utf-8');
|
|
56
|
-
return JSON.parse(data);
|
|
57
|
-
}
|
|
58
|
-
} catch {
|
|
59
|
-
// Return empty store on error
|
|
60
|
-
}
|
|
61
|
-
return { tasks: {}, version: '3.0.0' };
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function saveTaskStore(store: TaskStore): void {
|
|
65
|
-
ensureTaskDir();
|
|
66
|
-
writeFileSync(getTaskPath(), JSON.stringify(store, null, 2), 'utf-8');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export const taskTools: MCPTool[] = [
|
|
70
|
-
{
|
|
71
|
-
name: 'task/create',
|
|
72
|
-
description: 'Create a new task',
|
|
73
|
-
category: 'task',
|
|
74
|
-
inputSchema: {
|
|
75
|
-
type: 'object',
|
|
76
|
-
properties: {
|
|
77
|
-
type: { type: 'string', description: 'Task type (feature, bugfix, research, refactor)' },
|
|
78
|
-
description: { type: 'string', description: 'Task description' },
|
|
79
|
-
priority: { type: 'string', description: 'Task priority (low, normal, high, critical)' },
|
|
80
|
-
assignTo: { type: 'array', items: { type: 'string' }, description: 'Agent IDs to assign' },
|
|
81
|
-
tags: { type: 'array', items: { type: 'string' }, description: 'Task tags' },
|
|
82
|
-
},
|
|
83
|
-
required: ['type', 'description'],
|
|
84
|
-
},
|
|
85
|
-
handler: async (input) => {
|
|
86
|
-
const store = loadTaskStore();
|
|
87
|
-
const taskId = `task-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
88
|
-
|
|
89
|
-
const task: TaskRecord = {
|
|
90
|
-
taskId,
|
|
91
|
-
type: input.type as string,
|
|
92
|
-
description: input.description as string,
|
|
93
|
-
priority: (input.priority as TaskRecord['priority']) || 'normal',
|
|
94
|
-
status: 'pending',
|
|
95
|
-
progress: 0,
|
|
96
|
-
assignedTo: (input.assignTo as string[]) || [],
|
|
97
|
-
tags: (input.tags as string[]) || [],
|
|
98
|
-
createdAt: new Date().toISOString(),
|
|
99
|
-
startedAt: null,
|
|
100
|
-
completedAt: null,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
store.tasks[taskId] = task;
|
|
104
|
-
saveTaskStore(store);
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
taskId,
|
|
108
|
-
type: task.type,
|
|
109
|
-
description: task.description,
|
|
110
|
-
priority: task.priority,
|
|
111
|
-
status: task.status,
|
|
112
|
-
createdAt: task.createdAt,
|
|
113
|
-
assignedTo: task.assignedTo,
|
|
114
|
-
tags: task.tags,
|
|
115
|
-
};
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: 'task/status',
|
|
120
|
-
description: 'Get task status',
|
|
121
|
-
category: 'task',
|
|
122
|
-
inputSchema: {
|
|
123
|
-
type: 'object',
|
|
124
|
-
properties: {
|
|
125
|
-
taskId: { type: 'string', description: 'Task ID' },
|
|
126
|
-
},
|
|
127
|
-
required: ['taskId'],
|
|
128
|
-
},
|
|
129
|
-
handler: async (input) => {
|
|
130
|
-
const store = loadTaskStore();
|
|
131
|
-
const taskId = input.taskId as string;
|
|
132
|
-
const task = store.tasks[taskId];
|
|
133
|
-
|
|
134
|
-
if (task) {
|
|
135
|
-
return {
|
|
136
|
-
taskId: task.taskId,
|
|
137
|
-
type: task.type,
|
|
138
|
-
description: task.description,
|
|
139
|
-
status: task.status,
|
|
140
|
-
progress: task.progress,
|
|
141
|
-
priority: task.priority,
|
|
142
|
-
assignedTo: task.assignedTo,
|
|
143
|
-
tags: task.tags,
|
|
144
|
-
createdAt: task.createdAt,
|
|
145
|
-
startedAt: task.startedAt,
|
|
146
|
-
completedAt: task.completedAt,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return {
|
|
151
|
-
taskId,
|
|
152
|
-
status: 'not_found',
|
|
153
|
-
error: 'Task not found',
|
|
154
|
-
};
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
name: 'task/list',
|
|
159
|
-
description: 'List all tasks',
|
|
160
|
-
category: 'task',
|
|
161
|
-
inputSchema: {
|
|
162
|
-
type: 'object',
|
|
163
|
-
properties: {
|
|
164
|
-
status: { type: 'string', description: 'Filter by status' },
|
|
165
|
-
type: { type: 'string', description: 'Filter by type' },
|
|
166
|
-
assignedTo: { type: 'string', description: 'Filter by assigned agent' },
|
|
167
|
-
priority: { type: 'string', description: 'Filter by priority' },
|
|
168
|
-
limit: { type: 'number', description: 'Max tasks to return' },
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
handler: async (input) => {
|
|
172
|
-
const store = loadTaskStore();
|
|
173
|
-
let tasks = Object.values(store.tasks);
|
|
174
|
-
|
|
175
|
-
// Apply filters
|
|
176
|
-
if (input.status) {
|
|
177
|
-
// Support comma-separated status values
|
|
178
|
-
const statuses = (input.status as string).split(',').map(s => s.trim());
|
|
179
|
-
tasks = tasks.filter(t => statuses.includes(t.status));
|
|
180
|
-
}
|
|
181
|
-
if (input.type) {
|
|
182
|
-
tasks = tasks.filter(t => t.type === input.type);
|
|
183
|
-
}
|
|
184
|
-
if (input.assignedTo) {
|
|
185
|
-
tasks = tasks.filter(t => t.assignedTo.includes(input.assignedTo as string));
|
|
186
|
-
}
|
|
187
|
-
if (input.priority) {
|
|
188
|
-
tasks = tasks.filter(t => t.priority === input.priority);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// Sort by creation date (newest first)
|
|
192
|
-
tasks.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
193
|
-
|
|
194
|
-
// Apply limit
|
|
195
|
-
const limit = (input.limit as number) || 50;
|
|
196
|
-
tasks = tasks.slice(0, limit);
|
|
197
|
-
|
|
198
|
-
return {
|
|
199
|
-
tasks: tasks.map(t => ({
|
|
200
|
-
taskId: t.taskId,
|
|
201
|
-
type: t.type,
|
|
202
|
-
description: t.description,
|
|
203
|
-
status: t.status,
|
|
204
|
-
progress: t.progress,
|
|
205
|
-
priority: t.priority,
|
|
206
|
-
assignedTo: t.assignedTo,
|
|
207
|
-
createdAt: t.createdAt,
|
|
208
|
-
})),
|
|
209
|
-
total: tasks.length,
|
|
210
|
-
filters: {
|
|
211
|
-
status: input.status,
|
|
212
|
-
type: input.type,
|
|
213
|
-
assignedTo: input.assignedTo,
|
|
214
|
-
priority: input.priority,
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
name: 'task/complete',
|
|
221
|
-
description: 'Mark task as complete',
|
|
222
|
-
category: 'task',
|
|
223
|
-
inputSchema: {
|
|
224
|
-
type: 'object',
|
|
225
|
-
properties: {
|
|
226
|
-
taskId: { type: 'string', description: 'Task ID' },
|
|
227
|
-
result: { type: 'object', description: 'Task result data' },
|
|
228
|
-
},
|
|
229
|
-
required: ['taskId'],
|
|
230
|
-
},
|
|
231
|
-
handler: async (input) => {
|
|
232
|
-
const store = loadTaskStore();
|
|
233
|
-
const taskId = input.taskId as string;
|
|
234
|
-
const task = store.tasks[taskId];
|
|
235
|
-
|
|
236
|
-
if (task) {
|
|
237
|
-
task.status = 'completed';
|
|
238
|
-
task.progress = 100;
|
|
239
|
-
task.completedAt = new Date().toISOString();
|
|
240
|
-
task.result = (input.result as Record<string, unknown>) || {};
|
|
241
|
-
saveTaskStore(store);
|
|
242
|
-
|
|
243
|
-
return {
|
|
244
|
-
taskId: task.taskId,
|
|
245
|
-
status: task.status,
|
|
246
|
-
completedAt: task.completedAt,
|
|
247
|
-
result: task.result,
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
return {
|
|
252
|
-
taskId,
|
|
253
|
-
status: 'not_found',
|
|
254
|
-
error: 'Task not found',
|
|
255
|
-
};
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
name: 'task/update',
|
|
260
|
-
description: 'Update task status or progress',
|
|
261
|
-
category: 'task',
|
|
262
|
-
inputSchema: {
|
|
263
|
-
type: 'object',
|
|
264
|
-
properties: {
|
|
265
|
-
taskId: { type: 'string', description: 'Task ID' },
|
|
266
|
-
status: { type: 'string', description: 'New status' },
|
|
267
|
-
progress: { type: 'number', description: 'Progress percentage (0-100)' },
|
|
268
|
-
assignTo: { type: 'array', items: { type: 'string' }, description: 'Agent IDs to assign' },
|
|
269
|
-
},
|
|
270
|
-
required: ['taskId'],
|
|
271
|
-
},
|
|
272
|
-
handler: async (input) => {
|
|
273
|
-
const store = loadTaskStore();
|
|
274
|
-
const taskId = input.taskId as string;
|
|
275
|
-
const task = store.tasks[taskId];
|
|
276
|
-
|
|
277
|
-
if (task) {
|
|
278
|
-
if (input.status) {
|
|
279
|
-
const newStatus = input.status as TaskRecord['status'];
|
|
280
|
-
task.status = newStatus;
|
|
281
|
-
if (newStatus === 'in_progress' && !task.startedAt) {
|
|
282
|
-
task.startedAt = new Date().toISOString();
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
if (typeof input.progress === 'number') {
|
|
286
|
-
task.progress = Math.min(100, Math.max(0, input.progress as number));
|
|
287
|
-
}
|
|
288
|
-
if (input.assignTo) {
|
|
289
|
-
task.assignedTo = input.assignTo as string[];
|
|
290
|
-
}
|
|
291
|
-
saveTaskStore(store);
|
|
292
|
-
|
|
293
|
-
return {
|
|
294
|
-
success: true,
|
|
295
|
-
taskId: task.taskId,
|
|
296
|
-
status: task.status,
|
|
297
|
-
progress: task.progress,
|
|
298
|
-
assignedTo: task.assignedTo,
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
return {
|
|
303
|
-
success: false,
|
|
304
|
-
taskId,
|
|
305
|
-
error: 'Task not found',
|
|
306
|
-
};
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
name: 'task/cancel',
|
|
311
|
-
description: 'Cancel a task',
|
|
312
|
-
category: 'task',
|
|
313
|
-
inputSchema: {
|
|
314
|
-
type: 'object',
|
|
315
|
-
properties: {
|
|
316
|
-
taskId: { type: 'string', description: 'Task ID' },
|
|
317
|
-
reason: { type: 'string', description: 'Cancellation reason' },
|
|
318
|
-
},
|
|
319
|
-
required: ['taskId'],
|
|
320
|
-
},
|
|
321
|
-
handler: async (input) => {
|
|
322
|
-
const store = loadTaskStore();
|
|
323
|
-
const taskId = input.taskId as string;
|
|
324
|
-
const task = store.tasks[taskId];
|
|
325
|
-
|
|
326
|
-
if (task) {
|
|
327
|
-
task.status = 'cancelled';
|
|
328
|
-
task.completedAt = new Date().toISOString();
|
|
329
|
-
task.result = { cancelReason: input.reason || 'Cancelled by user' };
|
|
330
|
-
saveTaskStore(store);
|
|
331
|
-
|
|
332
|
-
return {
|
|
333
|
-
success: true,
|
|
334
|
-
taskId: task.taskId,
|
|
335
|
-
status: task.status,
|
|
336
|
-
cancelledAt: task.completedAt,
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
return {
|
|
341
|
-
success: false,
|
|
342
|
-
taskId,
|
|
343
|
-
error: 'Task not found',
|
|
344
|
-
};
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
];
|
package/src/mcp-tools/types.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Tool Types for CLI
|
|
3
|
-
*
|
|
4
|
-
* Local type definitions to avoid external imports outside package boundary.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export interface MCPToolInputSchema {
|
|
8
|
-
type: 'object';
|
|
9
|
-
properties: Record<string, unknown>;
|
|
10
|
-
required?: string[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface MCPToolResult {
|
|
14
|
-
content: Array<{
|
|
15
|
-
type: 'text' | 'image' | 'resource';
|
|
16
|
-
text?: string;
|
|
17
|
-
data?: string;
|
|
18
|
-
mimeType?: string;
|
|
19
|
-
}>;
|
|
20
|
-
isError?: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface MCPTool {
|
|
24
|
-
name: string;
|
|
25
|
-
description: string;
|
|
26
|
-
inputSchema: MCPToolInputSchema;
|
|
27
|
-
category?: string;
|
|
28
|
-
tags?: string[];
|
|
29
|
-
version?: string;
|
|
30
|
-
cacheable?: boolean;
|
|
31
|
-
cacheTTL?: number;
|
|
32
|
-
handler: (input: Record<string, unknown>, context?: Record<string, unknown>) => Promise<MCPToolResult | unknown>;
|
|
33
|
-
}
|