memory-journal-mcp 4.4.2 → 5.0.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/.github/workflows/codeql.yml +1 -6
- package/.github/workflows/docker-publish.yml +15 -49
- package/.github/workflows/lint-and-test.yml +1 -1
- package/.github/workflows/secrets-scanning.yml +4 -3
- package/.github/workflows/security-update.yml +3 -3
- package/CHANGELOG.md +213 -0
- package/CONTRIBUTING.md +132 -97
- package/DOCKER_README.md +184 -235
- package/Dockerfile +27 -24
- package/README.md +218 -190
- package/SECURITY.md +27 -35
- package/dist/cli.js +16 -1
- package/dist/cli.js.map +1 -1
- package/dist/constants/ServerInstructions.d.ts +5 -1
- package/dist/constants/ServerInstructions.d.ts.map +1 -1
- package/dist/constants/ServerInstructions.js +133 -73
- package/dist/constants/ServerInstructions.js.map +1 -1
- package/dist/constants/icons.d.ts +2 -2
- package/dist/constants/icons.d.ts.map +1 -1
- package/dist/constants/icons.js +7 -6
- package/dist/constants/icons.js.map +1 -1
- package/dist/database/SqliteAdapter.d.ts +37 -24
- package/dist/database/SqliteAdapter.d.ts.map +1 -1
- package/dist/database/SqliteAdapter.js +319 -157
- package/dist/database/SqliteAdapter.js.map +1 -1
- package/dist/database/schema.d.ts +45 -0
- package/dist/database/schema.d.ts.map +1 -0
- package/dist/database/schema.js +92 -0
- package/dist/database/schema.js.map +1 -0
- package/dist/filtering/ToolFilter.d.ts +1 -1
- package/dist/filtering/ToolFilter.d.ts.map +1 -1
- package/dist/filtering/ToolFilter.js +13 -2
- package/dist/filtering/ToolFilter.js.map +1 -1
- package/dist/github/GitHubIntegration.d.ts.map +1 -1
- package/dist/github/GitHubIntegration.js +1 -3
- package/dist/github/GitHubIntegration.js.map +1 -1
- package/dist/handlers/prompts/github.d.ts +12 -0
- package/dist/handlers/prompts/github.d.ts.map +1 -0
- package/dist/handlers/prompts/github.js +178 -0
- package/dist/handlers/prompts/github.js.map +1 -0
- package/dist/handlers/prompts/index.d.ts +23 -2
- package/dist/handlers/prompts/index.d.ts.map +1 -1
- package/dist/handlers/prompts/index.js +7 -432
- package/dist/handlers/prompts/index.js.map +1 -1
- package/dist/handlers/prompts/workflow.d.ts +12 -0
- package/dist/handlers/prompts/workflow.d.ts.map +1 -0
- package/dist/handlers/prompts/workflow.js +277 -0
- package/dist/handlers/prompts/workflow.js.map +1 -0
- package/dist/handlers/resources/core.d.ts +11 -0
- package/dist/handlers/resources/core.d.ts.map +1 -0
- package/dist/handlers/resources/core.js +433 -0
- package/dist/handlers/resources/core.js.map +1 -0
- package/dist/handlers/resources/github.d.ts +11 -0
- package/dist/handlers/resources/github.d.ts.map +1 -0
- package/dist/handlers/resources/github.js +314 -0
- package/dist/handlers/resources/github.js.map +1 -0
- package/dist/handlers/resources/graph.d.ts +11 -0
- package/dist/handlers/resources/graph.d.ts.map +1 -0
- package/dist/handlers/resources/graph.js +204 -0
- package/dist/handlers/resources/graph.js.map +1 -0
- package/dist/handlers/resources/index.d.ts +5 -20
- package/dist/handlers/resources/index.d.ts.map +1 -1
- package/dist/handlers/resources/index.js +16 -1278
- package/dist/handlers/resources/index.js.map +1 -1
- package/dist/handlers/resources/shared.d.ts +60 -0
- package/dist/handlers/resources/shared.d.ts.map +1 -0
- package/dist/handlers/resources/shared.js +49 -0
- package/dist/handlers/resources/shared.js.map +1 -0
- package/dist/handlers/resources/team.d.ts +13 -0
- package/dist/handlers/resources/team.d.ts.map +1 -0
- package/dist/handlers/resources/team.js +119 -0
- package/dist/handlers/resources/team.js.map +1 -0
- package/dist/handlers/resources/templates.d.ts +13 -0
- package/dist/handlers/resources/templates.d.ts.map +1 -0
- package/dist/handlers/resources/templates.js +310 -0
- package/dist/handlers/resources/templates.js.map +1 -0
- package/dist/handlers/tools/admin.d.ts +8 -0
- package/dist/handlers/tools/admin.d.ts.map +1 -0
- package/dist/handlers/tools/admin.js +270 -0
- package/dist/handlers/tools/admin.js.map +1 -0
- package/dist/handlers/tools/analytics.d.ts +8 -0
- package/dist/handlers/tools/analytics.d.ts.map +1 -0
- package/dist/handlers/tools/analytics.js +256 -0
- package/dist/handlers/tools/analytics.js.map +1 -0
- package/dist/handlers/tools/backup.d.ts +8 -0
- package/dist/handlers/tools/backup.d.ts.map +1 -0
- package/dist/handlers/tools/backup.js +224 -0
- package/dist/handlers/tools/backup.js.map +1 -0
- package/dist/handlers/tools/core.d.ts +9 -0
- package/dist/handlers/tools/core.d.ts.map +1 -0
- package/dist/handlers/tools/core.js +326 -0
- package/dist/handlers/tools/core.js.map +1 -0
- package/dist/handlers/tools/export.d.ts +8 -0
- package/dist/handlers/tools/export.d.ts.map +1 -0
- package/dist/handlers/tools/export.js +89 -0
- package/dist/handlers/tools/export.js.map +1 -0
- package/dist/handlers/tools/github/helpers.d.ts +34 -0
- package/dist/handlers/tools/github/helpers.d.ts.map +1 -0
- package/dist/handlers/tools/github/helpers.js +52 -0
- package/dist/handlers/tools/github/helpers.js.map +1 -0
- package/dist/handlers/tools/github/insights-tools.d.ts +8 -0
- package/dist/handlers/tools/github/insights-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/insights-tools.js +104 -0
- package/dist/handlers/tools/github/insights-tools.js.map +1 -0
- package/dist/handlers/tools/github/issue-tools.d.ts +8 -0
- package/dist/handlers/tools/github/issue-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/issue-tools.js +359 -0
- package/dist/handlers/tools/github/issue-tools.js.map +1 -0
- package/dist/handlers/tools/github/kanban-tools.d.ts +8 -0
- package/dist/handlers/tools/github/kanban-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/kanban-tools.js +108 -0
- package/dist/handlers/tools/github/kanban-tools.js.map +1 -0
- package/dist/handlers/tools/github/milestone-tools.d.ts +9 -0
- package/dist/handlers/tools/github/milestone-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/milestone-tools.js +302 -0
- package/dist/handlers/tools/github/milestone-tools.js.map +1 -0
- package/dist/handlers/tools/github/mutation-tools.d.ts +12 -0
- package/dist/handlers/tools/github/mutation-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/mutation-tools.js +15 -0
- package/dist/handlers/tools/github/mutation-tools.js.map +1 -0
- package/dist/handlers/tools/github/read-tools.d.ts +8 -0
- package/dist/handlers/tools/github/read-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/read-tools.js +260 -0
- package/dist/handlers/tools/github/read-tools.js.map +1 -0
- package/dist/handlers/tools/github/schemas.d.ts +467 -0
- package/dist/handlers/tools/github/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/github/schemas.js +335 -0
- package/dist/handlers/tools/github/schemas.js.map +1 -0
- package/dist/handlers/tools/github.d.ts +14 -0
- package/dist/handlers/tools/github.d.ts.map +1 -0
- package/dist/handlers/tools/github.js +28 -0
- package/dist/handlers/tools/github.js.map +1 -0
- package/dist/handlers/tools/index.d.ts +15 -20
- package/dist/handlers/tools/index.d.ts.map +1 -1
- package/dist/handlers/tools/index.js +117 -2909
- package/dist/handlers/tools/index.js.map +1 -1
- package/dist/handlers/tools/relationships.d.ts +8 -0
- package/dist/handlers/tools/relationships.d.ts.map +1 -0
- package/dist/handlers/tools/relationships.js +308 -0
- package/dist/handlers/tools/relationships.js.map +1 -0
- package/dist/handlers/tools/schemas.d.ts +108 -0
- package/dist/handlers/tools/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/schemas.js +122 -0
- package/dist/handlers/tools/schemas.js.map +1 -0
- package/dist/handlers/tools/search.d.ts +8 -0
- package/dist/handlers/tools/search.d.ts.map +1 -0
- package/dist/handlers/tools/search.js +282 -0
- package/dist/handlers/tools/search.js.map +1 -0
- package/dist/handlers/tools/team.d.ts +11 -0
- package/dist/handlers/tools/team.d.ts.map +1 -0
- package/dist/handlers/tools/team.js +239 -0
- package/dist/handlers/tools/team.js.map +1 -0
- package/dist/server/McpServer.d.ts +4 -0
- package/dist/server/McpServer.d.ts.map +1 -1
- package/dist/server/McpServer.js +48 -297
- package/dist/server/McpServer.js.map +1 -1
- package/dist/server/Scheduler.d.ts +91 -0
- package/dist/server/Scheduler.d.ts.map +1 -0
- package/dist/server/Scheduler.js +201 -0
- package/dist/server/Scheduler.js.map +1 -0
- package/dist/transports/http.d.ts +66 -0
- package/dist/transports/http.d.ts.map +1 -0
- package/dist/transports/http.js +519 -0
- package/dist/transports/http.js.map +1 -0
- package/dist/types/entities.d.ts +101 -0
- package/dist/types/entities.d.ts.map +1 -0
- package/dist/types/entities.js +5 -0
- package/dist/types/entities.js.map +1 -0
- package/dist/types/filtering.d.ts +34 -0
- package/dist/types/filtering.d.ts.map +1 -0
- package/dist/types/filtering.js +5 -0
- package/dist/types/filtering.js.map +1 -0
- package/dist/types/github.d.ts +166 -0
- package/dist/types/github.d.ts.map +1 -0
- package/dist/types/github.js +5 -0
- package/dist/types/github.js.map +1 -0
- package/dist/types/index.d.ts +35 -292
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.js.map +1 -1
- package/dist/utils/error-helpers.d.ts +37 -0
- package/dist/utils/error-helpers.d.ts.map +1 -0
- package/dist/utils/error-helpers.js +47 -0
- package/dist/utils/error-helpers.js.map +1 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +6 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/security-utils.d.ts +0 -21
- package/dist/utils/security-utils.d.ts.map +1 -1
- package/dist/utils/security-utils.js +0 -47
- package/dist/utils/security-utils.js.map +1 -1
- package/dist/vector/VectorSearchManager.d.ts.map +1 -1
- package/dist/vector/VectorSearchManager.js +9 -32
- package/dist/vector/VectorSearchManager.js.map +1 -1
- package/docker-compose.yml +11 -2
- package/hooks/README.md +107 -0
- package/hooks/cursor/hooks.json +10 -0
- package/hooks/cursor/memory-journal.mdc +22 -0
- package/hooks/cursor/session-end.sh +19 -0
- package/hooks/kilo-code/session-end-mode.json +11 -0
- package/hooks/kiro/session-end.md +13 -0
- package/mcp-config-example.json +1 -0
- package/package.json +11 -9
- package/playwright.config.ts +29 -0
- package/releases/v4.5.0.md +116 -0
- package/releases/v5.0.0.md +105 -0
- package/scripts/generate-server-instructions.ts +176 -0
- package/scripts/server-instructions-function-body.ts +77 -0
- package/server.json +3 -3
- package/src/cli.ts +45 -1
- package/src/constants/ServerInstructions.ts +133 -73
- package/src/constants/icons.ts +8 -7
- package/src/constants/server-instructions.md +268 -0
- package/src/database/SqliteAdapter.ts +358 -192
- package/src/database/schema.ts +125 -0
- package/src/filtering/ToolFilter.ts +13 -2
- package/src/github/GitHubIntegration.ts +1 -3
- package/src/handlers/prompts/github.ts +209 -0
- package/src/handlers/prompts/index.ts +10 -499
- package/src/handlers/prompts/workflow.ts +314 -0
- package/src/handlers/resources/core.ts +528 -0
- package/src/handlers/resources/github.ts +358 -0
- package/src/handlers/resources/graph.ts +254 -0
- package/src/handlers/resources/index.ts +23 -1570
- package/src/handlers/resources/shared.ts +103 -0
- package/src/handlers/resources/team.ts +133 -0
- package/src/handlers/resources/templates.ts +374 -0
- package/src/handlers/tools/admin.ts +285 -0
- package/src/handlers/tools/analytics.ts +301 -0
- package/src/handlers/tools/backup.ts +242 -0
- package/src/handlers/tools/core.ts +350 -0
- package/src/handlers/tools/export.ts +115 -0
- package/src/handlers/tools/github/helpers.ts +86 -0
- package/src/handlers/tools/github/insights-tools.ts +119 -0
- package/src/handlers/tools/github/issue-tools.ts +439 -0
- package/src/handlers/tools/github/kanban-tools.ts +134 -0
- package/src/handlers/tools/github/milestone-tools.ts +392 -0
- package/src/handlers/tools/github/mutation-tools.ts +17 -0
- package/src/handlers/tools/github/read-tools.ts +328 -0
- package/src/handlers/tools/github/schemas.ts +369 -0
- package/src/handlers/tools/github.ts +36 -0
- package/src/handlers/tools/index.ts +144 -3325
- package/src/handlers/tools/relationships.ts +358 -0
- package/src/handlers/tools/schemas.ts +132 -0
- package/src/handlers/tools/search.ts +343 -0
- package/src/handlers/tools/team.ts +273 -0
- package/src/server/McpServer.ts +63 -358
- package/src/server/Scheduler.ts +278 -0
- package/src/transports/http.ts +635 -0
- package/src/types/entities.ts +145 -0
- package/src/types/filtering.ts +54 -0
- package/src/types/github.ts +180 -0
- package/src/types/index.ts +67 -375
- package/src/utils/error-helpers.ts +52 -0
- package/src/utils/logger.ts +6 -3
- package/src/utils/security-utils.ts +0 -52
- package/src/vector/VectorSearchManager.ts +9 -33
- package/tests/constants/icons.test.ts +1 -2
- package/tests/constants/server-instructions.test.ts +30 -4
- package/tests/database/sqlite-adapter.test.ts +91 -7
- package/tests/e2e/auth.spec.ts +154 -0
- package/tests/e2e/health.spec.ts +63 -0
- package/tests/e2e/protocols.spec.ts +134 -0
- package/tests/e2e/resources.spec.ts +103 -0
- package/tests/e2e/scheduler.spec.ts +79 -0
- package/tests/e2e/security.spec.ts +91 -0
- package/tests/e2e/sessions.spec.ts +95 -0
- package/tests/e2e/stateless.spec.ts +121 -0
- package/tests/e2e/tools.spec.ts +111 -0
- package/tests/filtering/tool-filter.test.ts +46 -0
- package/tests/handlers/error-path-coverage.test.ts +324 -0
- package/tests/handlers/github-resource-handlers.test.ts +453 -0
- package/tests/handlers/github-tool-handlers.test.ts +899 -0
- package/tests/handlers/prompt-handler-coverage.test.ts +106 -0
- package/tests/handlers/prompt-handlers.test.ts +40 -0
- package/tests/handlers/resource-handler-coverage.test.ts +181 -0
- package/tests/handlers/resource-handlers.test.ts +33 -9
- package/tests/handlers/search-tool-handlers.test.ts +272 -0
- package/tests/handlers/targeted-gap-closure.test.ts +387 -0
- package/tests/handlers/team-resource-handlers.test.ts +156 -0
- package/tests/handlers/team-tool-handlers.test.ts +301 -0
- package/tests/handlers/tool-handler-coverage.test.ts +469 -0
- package/tests/handlers/tool-handlers.test.ts +2 -2
- package/tests/security/sql-injection.test.ts +3 -54
- package/tests/server/mcp-server.test.ts +503 -8
- package/tests/server/scheduler.test.ts +400 -0
- package/tests/transports/http-transport.test.ts +620 -0
- package/tests/vector/vector-search-manager.test.ts +60 -0
- package/vitest.config.ts +4 -1
- package/.memory-journal-team.db +0 -0
- package/.vscode/settings.json +0 -84
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Tool Error Path Coverage Tests
|
|
3
|
+
*
|
|
4
|
+
* Tests for remaining uncovered lines in:
|
|
5
|
+
* - read-tools.ts: STOP response (no owner/repo), error catch blocks
|
|
6
|
+
* - kanban-tools.ts: no-github error paths
|
|
7
|
+
* - core.ts: resolveTeamAuthor, share_with_team without teamDb
|
|
8
|
+
* - backup.ts: error catches
|
|
9
|
+
* - admin.ts: error catches
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'
|
|
13
|
+
import { callTool } from '../../src/handlers/tools/index.js'
|
|
14
|
+
import { SqliteAdapter } from '../../src/database/SqliteAdapter.js'
|
|
15
|
+
|
|
16
|
+
describe('Error Path Coverage', () => {
|
|
17
|
+
let db: SqliteAdapter
|
|
18
|
+
const testDbPath = './test-error-paths.db'
|
|
19
|
+
|
|
20
|
+
beforeAll(async () => {
|
|
21
|
+
db = new SqliteAdapter(testDbPath)
|
|
22
|
+
await db.initialize()
|
|
23
|
+
|
|
24
|
+
db.createEntry({
|
|
25
|
+
content: 'Error path test entry',
|
|
26
|
+
tags: ['error-test'],
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
afterAll(() => {
|
|
31
|
+
db.close()
|
|
32
|
+
try {
|
|
33
|
+
const fs = require('node:fs')
|
|
34
|
+
if (fs.existsSync(testDbPath)) fs.unlinkSync(testDbPath)
|
|
35
|
+
} catch {
|
|
36
|
+
// cleanup
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// ========================================================================
|
|
41
|
+
// read-tools.ts — STOP response when GitHub returns null owner/repo (line 49)
|
|
42
|
+
// ========================================================================
|
|
43
|
+
|
|
44
|
+
describe('GitHub read tools — STOP response (no owner/repo)', () => {
|
|
45
|
+
const mockGithubNoRepo = {
|
|
46
|
+
isApiAvailable: () => true,
|
|
47
|
+
getRepoInfo: async () => ({ owner: null, repo: null, branch: null }),
|
|
48
|
+
getCachedRepoInfo: () => null,
|
|
49
|
+
} as any
|
|
50
|
+
|
|
51
|
+
it('get_github_issues should STOP when no repo detected', async () => {
|
|
52
|
+
const result = (await callTool(
|
|
53
|
+
'get_github_issues',
|
|
54
|
+
{},
|
|
55
|
+
db,
|
|
56
|
+
undefined,
|
|
57
|
+
mockGithubNoRepo
|
|
58
|
+
)) as { error: string; requiresUserInput: boolean }
|
|
59
|
+
|
|
60
|
+
expect(result.error).toContain('STOP')
|
|
61
|
+
expect(result.requiresUserInput).toBe(true)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('get_github_prs should STOP when no repo detected', async () => {
|
|
65
|
+
const result = (await callTool(
|
|
66
|
+
'get_github_prs',
|
|
67
|
+
{},
|
|
68
|
+
db,
|
|
69
|
+
undefined,
|
|
70
|
+
mockGithubNoRepo
|
|
71
|
+
)) as { error: string; requiresUserInput: boolean }
|
|
72
|
+
|
|
73
|
+
expect(result.error).toContain('STOP')
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('get_github_issue should STOP when no repo detected', async () => {
|
|
77
|
+
const result = (await callTool(
|
|
78
|
+
'get_github_issue',
|
|
79
|
+
{ issue_number: 1 },
|
|
80
|
+
db,
|
|
81
|
+
undefined,
|
|
82
|
+
mockGithubNoRepo
|
|
83
|
+
)) as { error: string }
|
|
84
|
+
|
|
85
|
+
expect(result.error).toContain('STOP')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it('get_github_pr should STOP when no repo detected', async () => {
|
|
89
|
+
const result = (await callTool(
|
|
90
|
+
'get_github_pr',
|
|
91
|
+
{ pr_number: 1 },
|
|
92
|
+
db,
|
|
93
|
+
undefined,
|
|
94
|
+
mockGithubNoRepo
|
|
95
|
+
)) as { error: string }
|
|
96
|
+
|
|
97
|
+
expect(result.error).toContain('STOP')
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
// ========================================================================
|
|
102
|
+
// read-tools.ts — error catch blocks (lines 127, 188, 240, 276, 292, 323)
|
|
103
|
+
// ========================================================================
|
|
104
|
+
|
|
105
|
+
describe('GitHub read tools — error catches', () => {
|
|
106
|
+
const mockGithubThrows = {
|
|
107
|
+
isApiAvailable: () => true,
|
|
108
|
+
getRepoInfo: async () => {
|
|
109
|
+
throw new Error('GitHub API error')
|
|
110
|
+
},
|
|
111
|
+
getCachedRepoInfo: () => null,
|
|
112
|
+
} as any
|
|
113
|
+
|
|
114
|
+
it('get_github_issues should handle GitHub API errors', async () => {
|
|
115
|
+
const result = (await callTool(
|
|
116
|
+
'get_github_issues',
|
|
117
|
+
{},
|
|
118
|
+
db,
|
|
119
|
+
undefined,
|
|
120
|
+
mockGithubThrows
|
|
121
|
+
)) as { error: string }
|
|
122
|
+
|
|
123
|
+
expect(result.error).toBeDefined()
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
it('get_github_prs should handle GitHub API errors', async () => {
|
|
127
|
+
const result = (await callTool(
|
|
128
|
+
'get_github_prs',
|
|
129
|
+
{},
|
|
130
|
+
db,
|
|
131
|
+
undefined,
|
|
132
|
+
mockGithubThrows
|
|
133
|
+
)) as { error: string }
|
|
134
|
+
|
|
135
|
+
expect(result.error).toBeDefined()
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
it('get_github_issue should handle GitHub API errors', async () => {
|
|
139
|
+
const result = (await callTool(
|
|
140
|
+
'get_github_issue',
|
|
141
|
+
{ issue_number: 1 },
|
|
142
|
+
db,
|
|
143
|
+
undefined,
|
|
144
|
+
mockGithubThrows
|
|
145
|
+
)) as { error: string }
|
|
146
|
+
|
|
147
|
+
expect(result.error).toBeDefined()
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('get_github_pr should handle GitHub API errors', async () => {
|
|
151
|
+
const result = (await callTool(
|
|
152
|
+
'get_github_pr',
|
|
153
|
+
{ pr_number: 1 },
|
|
154
|
+
db,
|
|
155
|
+
undefined,
|
|
156
|
+
mockGithubThrows
|
|
157
|
+
)) as { error: string }
|
|
158
|
+
|
|
159
|
+
expect(result.error).toBeDefined()
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
it('get_github_context should handle GitHub API errors', async () => {
|
|
163
|
+
const result = (await callTool(
|
|
164
|
+
'get_github_context',
|
|
165
|
+
{},
|
|
166
|
+
db,
|
|
167
|
+
undefined,
|
|
168
|
+
mockGithubThrows
|
|
169
|
+
)) as { error: string }
|
|
170
|
+
|
|
171
|
+
expect(result.error).toBeDefined()
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
// ========================================================================
|
|
176
|
+
// read-tools.ts — issue/PR not found (lines 224, 276)
|
|
177
|
+
// ========================================================================
|
|
178
|
+
|
|
179
|
+
describe('GitHub read tools — not found responses', () => {
|
|
180
|
+
const mockGithubNotFound = {
|
|
181
|
+
isApiAvailable: () => true,
|
|
182
|
+
getRepoInfo: async () => ({ owner: 'test', repo: 'repo', branch: 'main' }),
|
|
183
|
+
getCachedRepoInfo: () => ({ owner: 'test', repo: 'repo' }),
|
|
184
|
+
getIssue: async () => null,
|
|
185
|
+
getPullRequest: async () => null,
|
|
186
|
+
} as any
|
|
187
|
+
|
|
188
|
+
it('get_github_issue should return not found', async () => {
|
|
189
|
+
const result = (await callTool(
|
|
190
|
+
'get_github_issue',
|
|
191
|
+
{ issue_number: 99999 },
|
|
192
|
+
db,
|
|
193
|
+
undefined,
|
|
194
|
+
mockGithubNotFound
|
|
195
|
+
)) as { error: string }
|
|
196
|
+
|
|
197
|
+
expect(result.error).toContain('not found')
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
it('get_github_pr should return not found', async () => {
|
|
201
|
+
const result = (await callTool(
|
|
202
|
+
'get_github_pr',
|
|
203
|
+
{ pr_number: 99999 },
|
|
204
|
+
db,
|
|
205
|
+
undefined,
|
|
206
|
+
mockGithubNotFound
|
|
207
|
+
)) as { error: string }
|
|
208
|
+
|
|
209
|
+
expect(result.error).toContain('not found')
|
|
210
|
+
})
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
// ========================================================================
|
|
214
|
+
// kanban-tools.ts — with GitHub but missing data (lines 54-56, 129)
|
|
215
|
+
// ========================================================================
|
|
216
|
+
|
|
217
|
+
describe('kanban tools — GitHub edge cases', () => {
|
|
218
|
+
const mockGithubNoOwner = {
|
|
219
|
+
isApiAvailable: () => true,
|
|
220
|
+
getRepoInfo: async () => ({ owner: null, repo: null, branch: null }),
|
|
221
|
+
getCachedRepoInfo: () => null,
|
|
222
|
+
} as any
|
|
223
|
+
|
|
224
|
+
it('get_kanban_board should handle missing owner', async () => {
|
|
225
|
+
const result = (await callTool(
|
|
226
|
+
'get_kanban_board',
|
|
227
|
+
{ project_number: 1 },
|
|
228
|
+
db,
|
|
229
|
+
undefined,
|
|
230
|
+
mockGithubNoOwner
|
|
231
|
+
)) as { error: string }
|
|
232
|
+
|
|
233
|
+
expect(result.error).toBeDefined()
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
it('move_kanban_item should handle missing owner', async () => {
|
|
237
|
+
const result = (await callTool(
|
|
238
|
+
'move_kanban_item',
|
|
239
|
+
{ project_number: 1, item_id: 'abc', target_status: 'Done' },
|
|
240
|
+
db,
|
|
241
|
+
undefined,
|
|
242
|
+
mockGithubNoOwner
|
|
243
|
+
)) as { error: string }
|
|
244
|
+
|
|
245
|
+
expect(result.error).toBeDefined()
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
// ========================================================================
|
|
250
|
+
// core.ts — create_entry with share_with_team but no teamDb (lines 162-164)
|
|
251
|
+
// ========================================================================
|
|
252
|
+
|
|
253
|
+
describe('core.ts — share_with_team without teamDb', () => {
|
|
254
|
+
it('should ignore share_with_team when teamDb is missing', async () => {
|
|
255
|
+
const result = (await callTool(
|
|
256
|
+
'create_entry',
|
|
257
|
+
{
|
|
258
|
+
content: 'Test share without team',
|
|
259
|
+
share_with_team: true,
|
|
260
|
+
},
|
|
261
|
+
db
|
|
262
|
+
)) as { success: boolean }
|
|
263
|
+
|
|
264
|
+
expect(result.success).toBe(true)
|
|
265
|
+
})
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
// ========================================================================
|
|
269
|
+
// backup.ts — error catch on backup_journal (line 102)
|
|
270
|
+
// ========================================================================
|
|
271
|
+
|
|
272
|
+
describe('backup.ts error paths', () => {
|
|
273
|
+
it('cleanup_backups should succeed with no old backups', async () => {
|
|
274
|
+
const result = (await callTool('cleanup_backups', { keep_count: 100 }, db)) as {
|
|
275
|
+
success: boolean
|
|
276
|
+
deletedCount: number
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
expect(result.success).toBe(true)
|
|
280
|
+
expect(result.deletedCount).toBe(0)
|
|
281
|
+
})
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
// ========================================================================
|
|
285
|
+
// admin.ts — error paths (lines 153, 205, 222, 247, 280)
|
|
286
|
+
// ========================================================================
|
|
287
|
+
|
|
288
|
+
describe('admin.ts error paths', () => {
|
|
289
|
+
it('update_entry should fail for nonexistent entry', async () => {
|
|
290
|
+
const result = (await callTool(
|
|
291
|
+
'update_entry',
|
|
292
|
+
{ entry_id: 99999, content: 'Updated' },
|
|
293
|
+
db
|
|
294
|
+
)) as { error: string }
|
|
295
|
+
|
|
296
|
+
expect(result.error).toBeDefined()
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
it('delete_entry should fail for nonexistent entry', async () => {
|
|
300
|
+
const result = (await callTool('delete_entry', { entry_id: 99999 }, db)) as {
|
|
301
|
+
error: string
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
expect(result.error).toBeDefined()
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
it('rebuild_vector_index should fail without vector manager', async () => {
|
|
308
|
+
const result = (await callTool('rebuild_vector_index', {}, db)) as { error: string }
|
|
309
|
+
|
|
310
|
+
expect(result.error).toContain('not available')
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
it('add_to_vector_index should fail without vector manager', async () => {
|
|
314
|
+
const result = (await callTool('add_to_vector_index', { entry_id: 1 }, db)) as {
|
|
315
|
+
error: string
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
expect(result.error).toContain('not available')
|
|
319
|
+
})
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
// Note: milestone-tools and issue-tools (mutations) require github in context
|
|
323
|
+
// during tool registration — their error catches are already covered by E2E tests.
|
|
324
|
+
})
|