@vibe-forge/mcp 0.10.0 → 0.10.1
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.
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { createToolTester } from './mcp-test-utils.js'
|
|
4
|
+
|
|
5
|
+
const mocks = vi.hoisted(() => {
|
|
6
|
+
return {
|
|
7
|
+
callHook: vi.fn(),
|
|
8
|
+
createChildSession: vi.fn(),
|
|
9
|
+
getParentSessionId: vi.fn(),
|
|
10
|
+
startTask: vi.fn(),
|
|
11
|
+
getTask: vi.fn(),
|
|
12
|
+
stopTask: vi.fn(),
|
|
13
|
+
getAllTasks: vi.fn(),
|
|
14
|
+
uuid: vi.fn()
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
vi.mock('@vibe-forge/hooks', () => ({
|
|
19
|
+
callHook: mocks.callHook
|
|
20
|
+
}))
|
|
21
|
+
|
|
22
|
+
vi.mock('@vibe-forge/utils/uuid', () => ({
|
|
23
|
+
uuid: mocks.uuid
|
|
24
|
+
}))
|
|
25
|
+
|
|
26
|
+
vi.mock('#~/sync.js', () => ({
|
|
27
|
+
createChildSession: mocks.createChildSession,
|
|
28
|
+
getParentSessionId: mocks.getParentSessionId
|
|
29
|
+
}))
|
|
30
|
+
|
|
31
|
+
vi.mock('#~/tools/task/manager.js', () => ({
|
|
32
|
+
TaskManager: class {
|
|
33
|
+
startTask = mocks.startTask
|
|
34
|
+
getTask = mocks.getTask
|
|
35
|
+
stopTask = mocks.stopTask
|
|
36
|
+
getAllTasks = mocks.getAllTasks
|
|
37
|
+
}
|
|
38
|
+
}))
|
|
39
|
+
|
|
40
|
+
describe('task tool integration', () => {
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
vi.clearAllMocks()
|
|
43
|
+
process.env.__VF_PROJECT_AI_SESSION_ID__ = 'sess-1'
|
|
44
|
+
let nextTaskId = 1
|
|
45
|
+
mocks.uuid.mockImplementation(() => `task-${nextTaskId++}`)
|
|
46
|
+
mocks.callHook.mockResolvedValue({ continue: true })
|
|
47
|
+
mocks.getParentSessionId.mockReturnValue(undefined)
|
|
48
|
+
mocks.startTask.mockResolvedValue(undefined)
|
|
49
|
+
mocks.getTask.mockImplementation((taskId: string) => ({
|
|
50
|
+
taskId,
|
|
51
|
+
status: 'completed',
|
|
52
|
+
logs: []
|
|
53
|
+
}))
|
|
54
|
+
mocks.stopTask.mockReturnValue(true)
|
|
55
|
+
mocks.getAllTasks.mockReturnValue([])
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('passes resolved task ids to the StartTasks hook', async () => {
|
|
59
|
+
const { createTaskRegister } = await import('#~/tools/task/index.js')
|
|
60
|
+
|
|
61
|
+
const tester = createToolTester()
|
|
62
|
+
createTaskRegister()(tester.mockRegister)
|
|
63
|
+
|
|
64
|
+
await tester.callTool('StartTasks', {
|
|
65
|
+
tasks: [{
|
|
66
|
+
description: 'only output ok',
|
|
67
|
+
type: 'default',
|
|
68
|
+
background: false
|
|
69
|
+
}]
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
expect(mocks.callHook).toHaveBeenCalledWith('StartTasks', expect.objectContaining({
|
|
73
|
+
sessionId: 'sess-1',
|
|
74
|
+
tasks: [expect.objectContaining({
|
|
75
|
+
taskId: 'task-1',
|
|
76
|
+
description: 'only output ok',
|
|
77
|
+
type: 'default',
|
|
78
|
+
background: false
|
|
79
|
+
})]
|
|
80
|
+
}))
|
|
81
|
+
expect(mocks.startTask).toHaveBeenCalledWith(expect.objectContaining({
|
|
82
|
+
taskId: 'task-1'
|
|
83
|
+
}))
|
|
84
|
+
})
|
|
85
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-forge/mcp",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Vibe Forge MCP server",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#~/*.js": {
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1.25.3",
|
|
34
34
|
"commander": "^12.1.0",
|
|
35
35
|
"zod": "^3.24.1",
|
|
36
|
-
"@vibe-forge/hooks": "^0.10.
|
|
36
|
+
"@vibe-forge/hooks": "^0.10.2",
|
|
37
37
|
"@vibe-forge/config": "^0.10.0",
|
|
38
|
-
"@vibe-forge/
|
|
39
|
-
"@vibe-forge/
|
|
40
|
-
"@vibe-forge/
|
|
41
|
-
"@vibe-forge/
|
|
42
|
-
"@vibe-forge/
|
|
38
|
+
"@vibe-forge/cli-helper": "^0.10.1",
|
|
39
|
+
"@vibe-forge/register": "^0.10.1",
|
|
40
|
+
"@vibe-forge/task": "^0.10.1",
|
|
41
|
+
"@vibe-forge/types": "^0.10.1",
|
|
42
|
+
"@vibe-forge/utils": "^0.10.1"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"test": "pnpm -C ../.. exec vitest run --workspace vitest.workspace.ts --project bundler packages/mcp/__tests__"
|
package/src/tools/task/index.ts
CHANGED
|
@@ -65,7 +65,7 @@ export const createTaskRegister = () => {
|
|
|
65
65
|
await callHook('StartTasks', {
|
|
66
66
|
cwd: process.cwd(),
|
|
67
67
|
sessionId: process.env.__VF_PROJECT_AI_SESSION_ID__!,
|
|
68
|
-
tasks
|
|
68
|
+
tasks: resolvedTasks
|
|
69
69
|
})
|
|
70
70
|
const syncResults = parentSessionId
|
|
71
71
|
? await Promise.allSettled(resolvedTasks.map(task =>
|