memory-journal-mcp 6.1.2 → 6.2.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.
- package/README.md +44 -28
- package/dist/{chunk-X4SWFATC.js → chunk-BI4ZNSKA.js} +38 -24
- package/dist/{chunk-HCEWINSB.js → chunk-N6EBIDN7.js} +99 -102
- package/dist/cli.js +2 -2
- package/dist/index.js +2 -2
- package/dist/tools-WPRY5MJ6.js +2 -0
- package/package.json +10 -1
- package/skills/github-commander/SKILL.md +151 -0
- package/skills/github-commander/config/project-config.example.md +125 -0
- package/skills/github-commander/workflows/code-quality-audit.md +80 -0
- package/skills/github-commander/workflows/full-audit.md +134 -0
- package/skills/github-commander/workflows/issue-triage.md +239 -0
- package/skills/github-commander/workflows/milestone-sprint.md +81 -0
- package/skills/github-commander/workflows/perf-audit.md +142 -0
- package/skills/github-commander/workflows/pr-review.md +123 -0
- package/skills/github-commander/workflows/security-audit.md +170 -0
- package/skills/github-commander/workflows/update-deps.md +109 -0
- package/.dockerignore +0 -139
- package/.gitattributes +0 -20
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -95
- package/.github/ISSUE_TEMPLATE/config.yml +0 -11
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -110
- package/.github/ISSUE_TEMPLATE/question.md +0 -78
- package/.github/aw/actions-lock.json +0 -14
- package/.github/copilot-instructions.md +0 -122
- package/.github/dependabot.yml +0 -93
- package/.github/pull_request_template.md +0 -135
- package/.github/workflows/README.md +0 -133
- package/.github/workflows/agentics-maintenance.yml +0 -141
- package/.github/workflows/auto-release.yml +0 -68
- package/.github/workflows/ci-health-monitor.lock.yml +0 -1121
- package/.github/workflows/ci-health-monitor.md +0 -87
- package/.github/workflows/codeql.yml +0 -41
- package/.github/workflows/dependabot-auto-merge.yml +0 -42
- package/.github/workflows/dependency-maintenance.lock.yml +0 -1182
- package/.github/workflows/dependency-maintenance.md +0 -147
- package/.github/workflows/docker-publish.yml +0 -254
- package/.github/workflows/docs-drift-detector.lock.yml +0 -1142
- package/.github/workflows/docs-drift-detector.md +0 -115
- package/.github/workflows/lint-and-test.yml +0 -60
- package/.github/workflows/publish-npm.yml +0 -85
- package/.github/workflows/secrets-scanning.yml +0 -32
- package/.github/workflows/security-update.yml +0 -127
- package/.gitleaks.toml +0 -9
- package/.prettierignore +0 -21
- package/.prettierrc +0 -33
- package/.scout-ignore +0 -12
- package/.trivyignore +0 -21
- package/CHANGELOG.md +0 -1814
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -263
- package/DOCKER_README.md +0 -331
- package/Dockerfile +0 -128
- package/SECURITY.md +0 -227
- package/UNRELEASED.md +0 -1
- package/dist/tools-T4U5A3X4.js +0 -2
- package/docker-compose.yml +0 -71
- package/docs/README.md +0 -18
- package/docs/agentic-journal-synergy.md +0 -175
- package/docs/copilot-setup.md +0 -72
- package/eslint.config.js +0 -110
- package/mcp-config-example.json +0 -21
- package/playwright.config.ts +0 -35
- package/releases/v2.1.0.md +0 -220
- package/releases/v2.2.0.md +0 -168
- package/releases/v3.0.0.md +0 -237
- package/releases/v3.1.0.md +0 -104
- package/releases/v3.1.1.md +0 -42
- package/releases/v3.1.2.md +0 -40
- package/releases/v3.1.3.md +0 -64
- package/releases/v3.1.4.md +0 -32
- package/releases/v3.1.5.md +0 -44
- package/releases/v4.0.0.md +0 -71
- package/releases/v4.1.0.md +0 -88
- package/releases/v4.2.0.md +0 -90
- package/releases/v4.3.0.md +0 -92
- package/releases/v4.3.1.md +0 -69
- package/releases/v4.4.0.md +0 -120
- package/releases/v4.4.1.md +0 -33
- package/releases/v4.4.2.md +0 -31
- package/releases/v4.5.0.md +0 -116
- package/releases/v5.0.0.md +0 -105
- package/releases/v5.0.1.md +0 -25
- package/releases/v5.1.0.md +0 -83
- package/releases/v5.1.1.md +0 -10
- package/releases/v6.0.0.md +0 -48
- package/releases/v6.0.1.md +0 -36
- package/releases/v6.1.0.md +0 -68
- package/releases/v6.1.1.md +0 -30
- package/releases/v6.1.2.md +0 -23
- package/scripts/generate-server-instructions.ts +0 -306
- package/scripts/server-instructions-function-body.ts +0 -107
- package/scripts/server-instructions-gotchas.ts +0 -45
- package/server.json +0 -42
- package/social-preview.png +0 -0
- package/src/auth/auth-context.ts +0 -78
- package/src/auth/authorization-server-discovery.ts +0 -263
- package/src/auth/errors.ts +0 -215
- package/src/auth/index.ts +0 -58
- package/src/auth/middleware.ts +0 -392
- package/src/auth/oauth-resource-server.ts +0 -170
- package/src/auth/scope-map.ts +0 -46
- package/src/auth/scopes.ts +0 -256
- package/src/auth/token-validator.ts +0 -293
- package/src/auth/transport-agnostic.ts +0 -164
- package/src/auth/types.ts +0 -372
- package/src/cli.ts +0 -279
- package/src/codemode/api-constants.ts +0 -263
- package/src/codemode/api.ts +0 -302
- package/src/codemode/auto-return.ts +0 -65
- package/src/codemode/index.ts +0 -47
- package/src/codemode/sandbox-factory.ts +0 -144
- package/src/codemode/sandbox.ts +0 -220
- package/src/codemode/security.ts +0 -155
- package/src/codemode/types.ts +0 -228
- package/src/codemode/worker-sandbox.ts +0 -277
- package/src/codemode/worker-script.ts +0 -239
- package/src/constants/icons.ts +0 -183
- package/src/constants/server-instructions.md +0 -166
- package/src/constants/server-instructions.ts +0 -514
- package/src/database/adapter-factory.ts +0 -16
- package/src/database/core/entry-columns.ts +0 -10
- package/src/database/core/interfaces.ts +0 -188
- package/src/database/core/schema.ts +0 -152
- package/src/database/sqlite-adapter/backup.ts +0 -167
- package/src/database/sqlite-adapter/entries/crud.ts +0 -233
- package/src/database/sqlite-adapter/entries/importance.ts +0 -76
- package/src/database/sqlite-adapter/entries/index.ts +0 -142
- package/src/database/sqlite-adapter/entries/search.ts +0 -294
- package/src/database/sqlite-adapter/entries/shared.ts +0 -102
- package/src/database/sqlite-adapter/entries/statistics.ts +0 -162
- package/src/database/sqlite-adapter/index.ts +0 -265
- package/src/database/sqlite-adapter/native-connection.ts +0 -301
- package/src/database/sqlite-adapter/relationships.ts +0 -70
- package/src/database/sqlite-adapter/tags.ts +0 -182
- package/src/filtering/tool-filter.ts +0 -312
- package/src/github/github-integration/client.ts +0 -114
- package/src/github/github-integration/index.ts +0 -297
- package/src/github/github-integration/insights.ts +0 -155
- package/src/github/github-integration/issues.ts +0 -213
- package/src/github/github-integration/milestones.ts +0 -262
- package/src/github/github-integration/projects.ts +0 -414
- package/src/github/github-integration/pull-requests.ts +0 -235
- package/src/github/github-integration/repository.ts +0 -110
- package/src/github/github-integration/types.ts +0 -43
- package/src/handlers/prompts/github.ts +0 -210
- package/src/handlers/prompts/index.ts +0 -97
- package/src/handlers/prompts/workflow.ts +0 -361
- package/src/handlers/resources/core/briefing/context-section.ts +0 -182
- package/src/handlers/resources/core/briefing/github-section.ts +0 -354
- package/src/handlers/resources/core/briefing/index.ts +0 -106
- package/src/handlers/resources/core/briefing/user-message.ts +0 -114
- package/src/handlers/resources/core/health.ts +0 -75
- package/src/handlers/resources/core/index.ts +0 -31
- package/src/handlers/resources/core/instructions.ts +0 -45
- package/src/handlers/resources/core/utilities.ts +0 -310
- package/src/handlers/resources/github.ts +0 -340
- package/src/handlers/resources/graph.ts +0 -218
- package/src/handlers/resources/help.ts +0 -410
- package/src/handlers/resources/index.ts +0 -143
- package/src/handlers/resources/shared.ts +0 -219
- package/src/handlers/resources/team.ts +0 -134
- package/src/handlers/resources/templates.ts +0 -334
- package/src/handlers/tools/admin.ts +0 -351
- package/src/handlers/tools/analytics.ts +0 -346
- package/src/handlers/tools/backup.ts +0 -272
- package/src/handlers/tools/codemode.ts +0 -188
- package/src/handlers/tools/core.ts +0 -359
- package/src/handlers/tools/error-fields-mixin.ts +0 -10
- package/src/handlers/tools/export.ts +0 -150
- package/src/handlers/tools/github/copilot-tools.ts +0 -72
- package/src/handlers/tools/github/helpers.ts +0 -125
- package/src/handlers/tools/github/insights-tools.ts +0 -112
- package/src/handlers/tools/github/issue-tools.ts +0 -442
- package/src/handlers/tools/github/kanban-tools.ts +0 -153
- package/src/handlers/tools/github/milestone-tools.ts +0 -371
- package/src/handlers/tools/github/mutation-tools.ts +0 -17
- package/src/handlers/tools/github/read-tools.ts +0 -302
- package/src/handlers/tools/github/schemas.ts +0 -435
- package/src/handlers/tools/github.ts +0 -39
- package/src/handlers/tools/index.ts +0 -255
- package/src/handlers/tools/relationships.ts +0 -390
- package/src/handlers/tools/schemas.ts +0 -165
- package/src/handlers/tools/search.ts +0 -448
- package/src/handlers/tools/team/admin-tools.ts +0 -164
- package/src/handlers/tools/team/analytics-tools.ts +0 -233
- package/src/handlers/tools/team/backup-tools.ts +0 -83
- package/src/handlers/tools/team/core-tools.ts +0 -197
- package/src/handlers/tools/team/export-tools.ts +0 -130
- package/src/handlers/tools/team/helpers.ts +0 -66
- package/src/handlers/tools/team/index.ts +0 -45
- package/src/handlers/tools/team/relationship-tools.ts +0 -219
- package/src/handlers/tools/team/schemas.ts +0 -558
- package/src/handlers/tools/team/search-tools.ts +0 -145
- package/src/handlers/tools/team/vector-tools.ts +0 -261
- package/src/index.ts +0 -57
- package/src/server/mcp-server.ts +0 -446
- package/src/server/registration.ts +0 -141
- package/src/server/scheduler.ts +0 -283
- package/src/transports/http/handlers.ts +0 -78
- package/src/transports/http/index.ts +0 -8
- package/src/transports/http/security.ts +0 -147
- package/src/transports/http/server/index.ts +0 -397
- package/src/transports/http/server/legacy-sse.ts +0 -87
- package/src/transports/http/server/stateful.ts +0 -222
- package/src/transports/http/server/stateless.ts +0 -42
- package/src/transports/http/types.ts +0 -132
- package/src/types/entities.ts +0 -145
- package/src/types/error-types.ts +0 -92
- package/src/types/errors.ts +0 -200
- package/src/types/filtering.ts +0 -55
- package/src/types/github.ts +0 -216
- package/src/types/index.ts +0 -348
- package/src/utils/error-helpers.ts +0 -78
- package/src/utils/errors/error-response-fields.ts +0 -29
- package/src/utils/errors/suggestions.ts +0 -94
- package/src/utils/github-helpers.ts +0 -33
- package/src/utils/logger.ts +0 -107
- package/src/utils/mcp-logger.ts +0 -155
- package/src/utils/progress-utils.ts +0 -100
- package/src/utils/query-helpers.ts +0 -78
- package/src/utils/resource-annotations.ts +0 -75
- package/src/utils/security-utils.ts +0 -198
- package/src/utils/vector-index-helpers.ts +0 -24
- package/src/vector/vector-search-manager.ts +0 -409
- package/src/version.ts +0 -15
- package/test-server/README.md +0 -193
- package/test-server/code-map.md +0 -399
- package/test-server/test-agent-experience.md +0 -213
- package/test-server/test-filter-instructions.mjs +0 -295
- package/test-server/test-instruction-levels.mjs +0 -102
- package/test-server/test-preflight.md +0 -55
- package/test-server/test-prompts.mjs +0 -185
- package/test-server/test-scheduler.mjs +0 -174
- package/test-server/test-tool-annotations.mjs +0 -115
- package/test-server/test-tools-codemode.md +0 -632
- package/test-server/test-tools-codemode2.md +0 -1218
- package/test-server/test-tools-team.md +0 -215
- package/test-server/test-tools.md +0 -429
- package/test-server/test-tools2.md +0 -361
- package/test-server/test-tools3.md +0 -396
- package/test-server/tool-reference.md +0 -231
- package/tests/README.md +0 -54
- package/tests/auth/auth-context.test.ts +0 -162
- package/tests/auth/authorization-server-discovery.test.ts +0 -265
- package/tests/auth/errors.test.ts +0 -170
- package/tests/auth/middleware.test.ts +0 -585
- package/tests/auth/oauth-resource-server.test.ts +0 -173
- package/tests/auth/scope-map.test.ts +0 -66
- package/tests/auth/scopes.test.ts +0 -347
- package/tests/auth/token-validator.test.ts +0 -271
- package/tests/codemode/api.test.ts +0 -396
- package/tests/codemode/auto-return.test.ts +0 -167
- package/tests/codemode/codemode-tool-handlers.test.ts +0 -197
- package/tests/codemode/sandbox-factory.test.ts +0 -152
- package/tests/codemode/sandbox.test.ts +0 -190
- package/tests/codemode/security.test.ts +0 -242
- package/tests/codemode/worker-sandbox.test.ts +0 -106
- package/tests/constants/icons.test.ts +0 -101
- package/tests/constants/server-instructions.test.ts +0 -514
- package/tests/database/crud-workflow-branches.test.ts +0 -418
- package/tests/database/database-branches.test.ts +0 -132
- package/tests/database/entries-auth-branches.test.ts +0 -390
- package/tests/database/native-connection.test.ts +0 -249
- package/tests/database/shared-helpers.test.ts +0 -103
- package/tests/database/sqlite-adapter.bench.ts +0 -63
- package/tests/database/sqlite-adapter.test.ts +0 -690
- package/tests/database/tags.test.ts +0 -134
- package/tests/e2e/README.md +0 -39
- package/tests/e2e/auth.spec.ts +0 -106
- package/tests/e2e/codemode-abuse.spec.ts +0 -75
- package/tests/e2e/health.spec.ts +0 -63
- package/tests/e2e/helpers.ts +0 -139
- package/tests/e2e/oauth-discovery.spec.ts +0 -102
- package/tests/e2e/oauth-scopes.spec.ts +0 -222
- package/tests/e2e/payloads-admin.spec.ts +0 -76
- package/tests/e2e/payloads-analytics.spec.ts +0 -37
- package/tests/e2e/payloads-backup-restore.spec.ts +0 -102
- package/tests/e2e/payloads-backup.spec.ts +0 -44
- package/tests/e2e/payloads-codemode-api.spec.ts +0 -131
- package/tests/e2e/payloads-codemode-readonly.spec.ts +0 -116
- package/tests/e2e/payloads-codemode.spec.ts +0 -116
- package/tests/e2e/payloads-core.spec.ts +0 -82
- package/tests/e2e/payloads-error-contracts.spec.ts +0 -159
- package/tests/e2e/payloads-export.spec.ts +0 -46
- package/tests/e2e/payloads-github-degradation.spec.ts +0 -73
- package/tests/e2e/payloads-github.spec.ts +0 -176
- package/tests/e2e/payloads-relationships.spec.ts +0 -56
- package/tests/e2e/payloads-search.spec.ts +0 -64
- package/tests/e2e/payloads-team-happy.spec.ts +0 -231
- package/tests/e2e/payloads-team.spec.ts +0 -174
- package/tests/e2e/prompts-expanded.spec.ts +0 -137
- package/tests/e2e/prompts.spec.ts +0 -62
- package/tests/e2e/protocols.spec.ts +0 -134
- package/tests/e2e/rate-limiting.spec.ts +0 -291
- package/tests/e2e/resources-briefing-env.spec.ts +0 -106
- package/tests/e2e/resources-complete.spec.ts +0 -180
- package/tests/e2e/resources-expanded.spec.ts +0 -83
- package/tests/e2e/resources-instructions-levels.spec.ts +0 -145
- package/tests/e2e/resources-templates.spec.ts +0 -123
- package/tests/e2e/resources.spec.ts +0 -103
- package/tests/e2e/scheduler.spec.ts +0 -79
- package/tests/e2e/security.spec.ts +0 -112
- package/tests/e2e/session-advanced.spec.ts +0 -152
- package/tests/e2e/sessions.spec.ts +0 -95
- package/tests/e2e/stateless.spec.ts +0 -79
- package/tests/e2e/streaming.spec.ts +0 -176
- package/tests/e2e/tool-filtering-presets.spec.ts +0 -192
- package/tests/e2e/tool-filtering.spec.ts +0 -77
- package/tests/e2e/tools.spec.ts +0 -111
- package/tests/filtering/tool-filter.test.ts +0 -314
- package/tests/github/client-issues-errors.test.ts +0 -433
- package/tests/github/github-integration-branches.test.ts +0 -490
- package/tests/github/github-integration.test.ts +0 -1015
- package/tests/github/github-managers-branches.test.ts +0 -907
- package/tests/github/pull-requests.test.ts +0 -334
- package/tests/handlers/analytics-branches.test.ts +0 -222
- package/tests/handlers/backup-branches.test.ts +0 -270
- package/tests/handlers/briefing-context-section.test.ts +0 -388
- package/tests/handlers/briefing-github-section.test.ts +0 -392
- package/tests/handlers/briefing-user-message.test.ts +0 -405
- package/tests/handlers/codemode-tools.test.ts +0 -85
- package/tests/handlers/copilot-tools.test.ts +0 -126
- package/tests/handlers/error-path-coverage.test.ts +0 -324
- package/tests/handlers/export-tools.test.ts +0 -203
- package/tests/handlers/github-resource-handlers.test.ts +0 -929
- package/tests/handlers/github-tool-handlers.test.ts +0 -1452
- package/tests/handlers/handler-error-branches.test.ts +0 -346
- package/tests/handlers/help-resource.test.ts +0 -92
- package/tests/handlers/prompt-handler-coverage.test.ts +0 -108
- package/tests/handlers/prompt-handlers.test.ts +0 -131
- package/tests/handlers/resource-handler-coverage.test.ts +0 -281
- package/tests/handlers/resource-handlers.test.ts +0 -357
- package/tests/handlers/resource-prompt-branches.test.ts +0 -495
- package/tests/handlers/search-tool-handlers.test.ts +0 -379
- package/tests/handlers/targeted-gap-closure.test.ts +0 -387
- package/tests/handlers/team-admin.test.ts +0 -291
- package/tests/handlers/team-analytics.test.ts +0 -220
- package/tests/handlers/team-core.test.ts +0 -148
- package/tests/handlers/team-data.test.ts +0 -198
- package/tests/handlers/team-relationships.test.ts +0 -271
- package/tests/handlers/team-resource-handlers.test.ts +0 -161
- package/tests/handlers/team-search.test.ts +0 -134
- package/tests/handlers/team-tool-handlers.test.ts +0 -301
- package/tests/handlers/team-vector.test.ts +0 -213
- package/tests/handlers/template-github-branches.test.ts +0 -676
- package/tests/handlers/tool-annotations.test.ts +0 -90
- package/tests/handlers/tool-handler-coverage.test.ts +0 -514
- package/tests/handlers/tool-handlers.test.ts +0 -510
- package/tests/handlers/tool-output-schemas.test.ts +0 -116
- package/tests/handlers/vector-tool-handlers.test.ts +0 -238
- package/tests/security/sql-injection.test.ts +0 -284
- package/tests/server/mcp-server.bench.ts +0 -55
- package/tests/server/mcp-server.test.ts +0 -1326
- package/tests/server/scheduler.test.ts +0 -400
- package/tests/transports/http-legacy-sse.test.ts +0 -275
- package/tests/transports/http-security.test.ts +0 -322
- package/tests/transports/http-stateful.test.ts +0 -487
- package/tests/transports/http-transport-server.test.ts +0 -301
- package/tests/transports/http-transport.test.ts +0 -771
- package/tests/utils/github-helpers.test.ts +0 -58
- package/tests/utils/logger.test.ts +0 -180
- package/tests/utils/mcp-logger.test.ts +0 -211
- package/tests/utils/progress-utils.test.ts +0 -156
- package/tests/utils/query-helpers.test.ts +0 -80
- package/tests/utils/security-utils.test.ts +0 -82
- package/tests/vector/vector-search-branches.test.ts +0 -111
- package/tests/vector/vector-search-manager.test.ts +0 -375
- package/tests/vector/vector-search.bench.ts +0 -48
- package/tsconfig.json +0 -42
- package/tsup.config.ts +0 -19
- package/vitest.config.ts +0 -25
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Additional Coverage Tests — Targeted Gap Closure
|
|
3
|
-
*
|
|
4
|
-
* Tests for remaining uncovered lines in:
|
|
5
|
-
* - core.ts: resolveTeamAuthor fallback, list_tags/test_simple error paths
|
|
6
|
-
* - backup.ts: backup_journal error, list_backups error
|
|
7
|
-
* - team.ts: team_create_entry, team_get_recent, team_search without teamDb
|
|
8
|
-
* - read-tools.ts: GitHub tools without integration
|
|
9
|
-
* - kanban-tools.ts: empty kanban
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest'
|
|
13
|
-
import { callTool } from '../../src/handlers/tools/index.js'
|
|
14
|
-
import { DatabaseAdapter } from '../../src/database/sqlite-adapter/index.js'
|
|
15
|
-
|
|
16
|
-
describe('Targeted Gap Closure', () => {
|
|
17
|
-
let db: DatabaseAdapter
|
|
18
|
-
let teamDb: DatabaseAdapter
|
|
19
|
-
const testDbPath = './test-gaps.db'
|
|
20
|
-
const teamDbPath = './test-gaps-team.db'
|
|
21
|
-
|
|
22
|
-
beforeAll(async () => {
|
|
23
|
-
db = new DatabaseAdapter(testDbPath)
|
|
24
|
-
await db.initialize()
|
|
25
|
-
teamDb = new DatabaseAdapter(teamDbPath)
|
|
26
|
-
await teamDb.initialize()
|
|
27
|
-
|
|
28
|
-
db.createEntry({
|
|
29
|
-
content: 'Gap closure test entry',
|
|
30
|
-
tags: ['gap-test'],
|
|
31
|
-
projectNumber: 1,
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
afterAll(() => {
|
|
36
|
-
db.close()
|
|
37
|
-
teamDb.close()
|
|
38
|
-
try {
|
|
39
|
-
const fs = require('node:fs')
|
|
40
|
-
for (const p of [testDbPath, teamDbPath]) {
|
|
41
|
-
if (fs.existsSync(p)) fs.unlinkSync(p)
|
|
42
|
-
}
|
|
43
|
-
} catch {
|
|
44
|
-
// Ignore cleanup errors
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
// ========================================================================
|
|
49
|
-
// core.ts — test_simple, list_tags error paths (lines 310, 327, 345)
|
|
50
|
-
// ========================================================================
|
|
51
|
-
|
|
52
|
-
describe('test_simple', () => {
|
|
53
|
-
it('should return default message when no param', async () => {
|
|
54
|
-
const result = (await callTool('test_simple', {}, db)) as { message: string }
|
|
55
|
-
expect(result.message).toContain('Test response: Hello')
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('should return custom message', async () => {
|
|
59
|
-
const result = (await callTool('test_simple', { message: 'World' }, db)) as {
|
|
60
|
-
message: string
|
|
61
|
-
}
|
|
62
|
-
expect(result.message).toContain('World')
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
describe('list_tags', () => {
|
|
67
|
-
it('should list tags with counts', async () => {
|
|
68
|
-
const result = (await callTool('list_tags', {}, db)) as {
|
|
69
|
-
tags: { name: string; count: number }[]
|
|
70
|
-
count: number
|
|
71
|
-
}
|
|
72
|
-
expect(result.count).toBeGreaterThan(0)
|
|
73
|
-
expect(result.tags[0]).toHaveProperty('name')
|
|
74
|
-
expect(result.tags[0]).toHaveProperty('count')
|
|
75
|
-
})
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
// ========================================================================
|
|
79
|
-
// core.ts — create_entry with vectorManager (fire-and-forget)
|
|
80
|
-
// ========================================================================
|
|
81
|
-
|
|
82
|
-
describe('create_entry_minimal with vectorManager', () => {
|
|
83
|
-
it('should auto-index entry to vector store', async () => {
|
|
84
|
-
const vectorManager = {
|
|
85
|
-
isInitialized: vi.fn().mockReturnValue(true),
|
|
86
|
-
initialize: vi.fn().mockResolvedValue(undefined),
|
|
87
|
-
search: vi.fn().mockResolvedValue([]),
|
|
88
|
-
addEntry: vi.fn().mockResolvedValue(true),
|
|
89
|
-
removeEntry: vi.fn().mockResolvedValue(true),
|
|
90
|
-
rebuildIndex: vi.fn().mockResolvedValue(0),
|
|
91
|
-
getStats: vi.fn().mockResolvedValue({ itemCount: 0, modelName: 'test' }),
|
|
92
|
-
generateEmbedding: vi.fn().mockResolvedValue([]),
|
|
93
|
-
} as any
|
|
94
|
-
|
|
95
|
-
const result = (await callTool(
|
|
96
|
-
'create_entry_minimal',
|
|
97
|
-
{ content: 'Minimal entry with vector indexing' },
|
|
98
|
-
db,
|
|
99
|
-
vectorManager
|
|
100
|
-
)) as { success: boolean }
|
|
101
|
-
|
|
102
|
-
expect(result.success).toBe(true)
|
|
103
|
-
expect(vectorManager.addEntry).toHaveBeenCalled()
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
// ========================================================================
|
|
108
|
-
// core.ts — get_entry_by_id not found (line 266)
|
|
109
|
-
// ========================================================================
|
|
110
|
-
|
|
111
|
-
describe('get_entry_by_id not found', () => {
|
|
112
|
-
it('should return error for nonexistent entry', async () => {
|
|
113
|
-
const result = (await callTool('get_entry_by_id', { entry_id: 99999 }, db)) as {
|
|
114
|
-
error: string
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
expect(result.error).toContain('not found')
|
|
118
|
-
})
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
// ========================================================================
|
|
122
|
-
// core.ts — get_recent_entries error (line 284)
|
|
123
|
-
// ========================================================================
|
|
124
|
-
|
|
125
|
-
describe('get_recent_entries', () => {
|
|
126
|
-
it('should return entries with is_personal filter', async () => {
|
|
127
|
-
const result = (await callTool(
|
|
128
|
-
'get_recent_entries',
|
|
129
|
-
{ limit: 5, is_personal: false },
|
|
130
|
-
db
|
|
131
|
-
)) as { entries: unknown[]; count: number }
|
|
132
|
-
|
|
133
|
-
expect(result.count).toBeGreaterThanOrEqual(0)
|
|
134
|
-
})
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
// ========================================================================
|
|
138
|
-
// backup.ts — backup_journal (line 102 error), list_backups (line 127 error)
|
|
139
|
-
// ========================================================================
|
|
140
|
-
|
|
141
|
-
describe('backup_journal', () => {
|
|
142
|
-
it('should create a backup with custom name', async () => {
|
|
143
|
-
const result = (await callTool('backup_journal', { name: 'test-gap-backup' }, db)) as {
|
|
144
|
-
success: boolean
|
|
145
|
-
filename: string
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
expect(result.success).toBe(true)
|
|
149
|
-
expect(result.filename).toContain('test-gap-backup')
|
|
150
|
-
})
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
describe('list_backups', () => {
|
|
154
|
-
it('should list available backups', async () => {
|
|
155
|
-
const result = (await callTool('list_backups', {}, db)) as {
|
|
156
|
-
total: number
|
|
157
|
-
backupsDirectory: string
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
expect(result.total).toBeGreaterThanOrEqual(0)
|
|
161
|
-
expect(result.backupsDirectory).toBeDefined()
|
|
162
|
-
})
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
// ========================================================================
|
|
166
|
-
// team.ts — tools without teamDb (lines 42, 185, 219, 268)
|
|
167
|
-
// ========================================================================
|
|
168
|
-
|
|
169
|
-
describe('team tools without teamDb', () => {
|
|
170
|
-
it('team_create_entry should return error', async () => {
|
|
171
|
-
const result = (await callTool('team_create_entry', { content: 'Test entry' }, db)) as {
|
|
172
|
-
success: boolean
|
|
173
|
-
error: string
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
expect(result.success).toBe(false)
|
|
177
|
-
expect(result.error).toContain('Team database not configured')
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
it('team_get_recent should return error', async () => {
|
|
181
|
-
const result = (await callTool('team_get_recent', { limit: 5 }, db)) as {
|
|
182
|
-
success: boolean
|
|
183
|
-
error: string
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
expect(result.success).toBe(false)
|
|
187
|
-
expect(result.error).toContain('Team database not configured')
|
|
188
|
-
})
|
|
189
|
-
|
|
190
|
-
it('team_search should return error', async () => {
|
|
191
|
-
const result = (await callTool('team_search', { query: 'test' }, db)) as {
|
|
192
|
-
success: boolean
|
|
193
|
-
error: string
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
expect(result.success).toBe(false)
|
|
197
|
-
expect(result.error).toContain('Team database not configured')
|
|
198
|
-
})
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
// ========================================================================
|
|
202
|
-
// team.ts — team_create_entry with teamDb (lines 149-151)
|
|
203
|
-
// ========================================================================
|
|
204
|
-
|
|
205
|
-
describe('team_create_entry with teamDb', () => {
|
|
206
|
-
it('should create entry in team database', async () => {
|
|
207
|
-
const result = (await callTool(
|
|
208
|
-
'team_create_entry',
|
|
209
|
-
{
|
|
210
|
-
content: 'Team collaboration entry',
|
|
211
|
-
tags: ['team-test'],
|
|
212
|
-
},
|
|
213
|
-
db,
|
|
214
|
-
undefined,
|
|
215
|
-
undefined,
|
|
216
|
-
undefined,
|
|
217
|
-
undefined,
|
|
218
|
-
teamDb
|
|
219
|
-
)) as { success: boolean; author: string }
|
|
220
|
-
|
|
221
|
-
// May fail at setting author column (no author column in schema)
|
|
222
|
-
// but should still attempt the code path
|
|
223
|
-
expect(result.success !== undefined || result.author !== undefined).toBe(true)
|
|
224
|
-
})
|
|
225
|
-
|
|
226
|
-
it('should handle invalid entry_type', async () => {
|
|
227
|
-
const result = (await callTool(
|
|
228
|
-
'team_create_entry',
|
|
229
|
-
{
|
|
230
|
-
content: 'Bad type entry',
|
|
231
|
-
entry_type: 'invalid_type_xyz',
|
|
232
|
-
},
|
|
233
|
-
db,
|
|
234
|
-
undefined,
|
|
235
|
-
undefined,
|
|
236
|
-
undefined,
|
|
237
|
-
undefined,
|
|
238
|
-
teamDb
|
|
239
|
-
)) as { error: string }
|
|
240
|
-
|
|
241
|
-
expect(result.error).toBeDefined()
|
|
242
|
-
})
|
|
243
|
-
})
|
|
244
|
-
|
|
245
|
-
// ========================================================================
|
|
246
|
-
// team.ts — team_get_recent with teamDb
|
|
247
|
-
// ========================================================================
|
|
248
|
-
|
|
249
|
-
describe('team_get_recent with teamDb', () => {
|
|
250
|
-
it('should attempt to enrich entries with author', async () => {
|
|
251
|
-
teamDb.createEntry({ content: 'Team recent test entry' })
|
|
252
|
-
|
|
253
|
-
const result = (await callTool(
|
|
254
|
-
'team_get_recent',
|
|
255
|
-
{ limit: 5 },
|
|
256
|
-
db,
|
|
257
|
-
undefined,
|
|
258
|
-
undefined,
|
|
259
|
-
undefined,
|
|
260
|
-
undefined,
|
|
261
|
-
teamDb
|
|
262
|
-
)) as Record<string, unknown>
|
|
263
|
-
|
|
264
|
-
// May return error (no author column) or entries — covers the code path
|
|
265
|
-
expect(result).toBeDefined()
|
|
266
|
-
})
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
// ========================================================================
|
|
270
|
-
// team.ts — team_search with teamDb
|
|
271
|
-
// ========================================================================
|
|
272
|
-
|
|
273
|
-
describe('team_search with teamDb', () => {
|
|
274
|
-
it('should attempt search and author enrichment', async () => {
|
|
275
|
-
const result = (await callTool(
|
|
276
|
-
'team_search',
|
|
277
|
-
{ query: 'Team recent', limit: 5 },
|
|
278
|
-
db,
|
|
279
|
-
undefined,
|
|
280
|
-
undefined,
|
|
281
|
-
undefined,
|
|
282
|
-
undefined,
|
|
283
|
-
teamDb
|
|
284
|
-
)) as Record<string, unknown>
|
|
285
|
-
|
|
286
|
-
// Covers search path — may error at author enrichment
|
|
287
|
-
expect(result).toBeDefined()
|
|
288
|
-
})
|
|
289
|
-
|
|
290
|
-
it('should attempt tag-filtered search', async () => {
|
|
291
|
-
const result = (await callTool(
|
|
292
|
-
'team_search',
|
|
293
|
-
{ tags: ['team-test'], limit: 5 },
|
|
294
|
-
db,
|
|
295
|
-
undefined,
|
|
296
|
-
undefined,
|
|
297
|
-
undefined,
|
|
298
|
-
undefined,
|
|
299
|
-
teamDb
|
|
300
|
-
)) as Record<string, unknown>
|
|
301
|
-
|
|
302
|
-
expect(result).toBeDefined()
|
|
303
|
-
})
|
|
304
|
-
|
|
305
|
-
it('should attempt recent fallback (no query)', async () => {
|
|
306
|
-
const result = (await callTool(
|
|
307
|
-
'team_search',
|
|
308
|
-
{ limit: 3 },
|
|
309
|
-
db,
|
|
310
|
-
undefined,
|
|
311
|
-
undefined,
|
|
312
|
-
undefined,
|
|
313
|
-
undefined,
|
|
314
|
-
teamDb
|
|
315
|
-
)) as Record<string, unknown>
|
|
316
|
-
|
|
317
|
-
expect(result).toBeDefined()
|
|
318
|
-
})
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
// ========================================================================
|
|
322
|
-
// read-tools.ts — GitHub tools without integration (lines 49, 127, 188, etc.)
|
|
323
|
-
// ========================================================================
|
|
324
|
-
|
|
325
|
-
describe('GitHub read tools without integration', () => {
|
|
326
|
-
it('get_github_issues should return error', async () => {
|
|
327
|
-
const result = (await callTool('get_github_issues', {}, db)) as { error: string }
|
|
328
|
-
|
|
329
|
-
expect(result.error).toContain('not available')
|
|
330
|
-
})
|
|
331
|
-
|
|
332
|
-
it('get_github_prs should return error', async () => {
|
|
333
|
-
const result = (await callTool('get_github_prs', {}, db)) as { error: string }
|
|
334
|
-
|
|
335
|
-
expect(result.error).toContain('not available')
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
it('get_github_issue should return error', async () => {
|
|
339
|
-
const result = (await callTool('get_github_issue', { issue_number: 1 }, db)) as {
|
|
340
|
-
error: string
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
expect(result.error).toContain('not available')
|
|
344
|
-
})
|
|
345
|
-
|
|
346
|
-
it('get_github_pr should return error', async () => {
|
|
347
|
-
const result = (await callTool('get_github_pr', { pr_number: 1 }, db)) as {
|
|
348
|
-
error: string
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
expect(result.error).toContain('not available')
|
|
352
|
-
})
|
|
353
|
-
|
|
354
|
-
it('get_github_context should return error', async () => {
|
|
355
|
-
const result = (await callTool('get_github_context', {}, db)) as { error: string }
|
|
356
|
-
|
|
357
|
-
expect(result.error).toContain('not available')
|
|
358
|
-
})
|
|
359
|
-
})
|
|
360
|
-
|
|
361
|
-
// Note: GitHub write/mutation tools are only registered when `github`
|
|
362
|
-
// context is provided, so they can't be tested via callTool without it.
|
|
363
|
-
|
|
364
|
-
// ========================================================================
|
|
365
|
-
// kanban-tools.ts — without GitHub (lines 54-56, 129)
|
|
366
|
-
// ========================================================================
|
|
367
|
-
|
|
368
|
-
describe('kanban tools without integration', () => {
|
|
369
|
-
it('get_kanban_board should return error', async () => {
|
|
370
|
-
const result = (await callTool('get_kanban_board', { project_number: 1 }, db)) as {
|
|
371
|
-
error: string
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
expect(result.error).toContain('not available')
|
|
375
|
-
})
|
|
376
|
-
|
|
377
|
-
it('move_kanban_item should return error', async () => {
|
|
378
|
-
const result = (await callTool(
|
|
379
|
-
'move_kanban_item',
|
|
380
|
-
{ project_number: 1, item_id: 'abc', target_status: 'Done' },
|
|
381
|
-
db
|
|
382
|
-
)) as { error: string }
|
|
383
|
-
|
|
384
|
-
expect(result.error).toContain('not available')
|
|
385
|
-
})
|
|
386
|
-
})
|
|
387
|
-
})
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Team Admin Tool Handler Tests
|
|
3
|
-
*
|
|
4
|
-
* Tests the team admin tool group: team_update_entry, team_delete_entry, team_merge_tags
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { describe, it, expect, beforeAll, afterAll } from 'vitest'
|
|
8
|
-
import { callTool } from '../../src/handlers/tools/index.js'
|
|
9
|
-
import { DatabaseAdapter } from '../../src/database/sqlite-adapter/index.js'
|
|
10
|
-
|
|
11
|
-
describe('Team Admin Tool Handlers', () => {
|
|
12
|
-
let personalDb: DatabaseAdapter
|
|
13
|
-
let teamDb: DatabaseAdapter
|
|
14
|
-
const personalDbPath = './test-team-admin-personal.db'
|
|
15
|
-
const teamDbPath = './test-team-admin-team.db'
|
|
16
|
-
|
|
17
|
-
beforeAll(async () => {
|
|
18
|
-
try {
|
|
19
|
-
const fs = require('node:fs')
|
|
20
|
-
if (fs.existsSync(personalDbPath)) fs.unlinkSync(personalDbPath)
|
|
21
|
-
if (fs.existsSync(teamDbPath)) fs.unlinkSync(teamDbPath)
|
|
22
|
-
} catch {}
|
|
23
|
-
|
|
24
|
-
personalDb = new DatabaseAdapter(personalDbPath)
|
|
25
|
-
await personalDb.initialize()
|
|
26
|
-
|
|
27
|
-
teamDb = new DatabaseAdapter(teamDbPath)
|
|
28
|
-
await teamDb.initialize()
|
|
29
|
-
teamDb.applyTeamSchema()
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
afterAll(() => {
|
|
33
|
-
personalDb.close()
|
|
34
|
-
teamDb.close()
|
|
35
|
-
try {
|
|
36
|
-
const fs = require('node:fs')
|
|
37
|
-
if (fs.existsSync(personalDbPath)) fs.unlinkSync(personalDbPath)
|
|
38
|
-
if (fs.existsSync(teamDbPath)) fs.unlinkSync(teamDbPath)
|
|
39
|
-
} catch {
|
|
40
|
-
// Ignore cleanup errors
|
|
41
|
-
}
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
describe('team_update_entry', () => {
|
|
45
|
-
it('should update an existing team entry', async () => {
|
|
46
|
-
const createResult = (await callTool(
|
|
47
|
-
'team_create_entry',
|
|
48
|
-
{ content: 'Original content', entry_type: 'technical_note', tags: ['old-tag'] },
|
|
49
|
-
personalDb,
|
|
50
|
-
undefined,
|
|
51
|
-
undefined,
|
|
52
|
-
undefined,
|
|
53
|
-
undefined,
|
|
54
|
-
teamDb
|
|
55
|
-
)) as any
|
|
56
|
-
|
|
57
|
-
console.error('DEBUG TEAM ADMIN CREATE ENTRY', JSON.stringify(createResult, null, 2))
|
|
58
|
-
expect(createResult.success).toBe(true)
|
|
59
|
-
const entryId = createResult.entry.id
|
|
60
|
-
|
|
61
|
-
const updateResult = (await callTool(
|
|
62
|
-
'team_update_entry',
|
|
63
|
-
{
|
|
64
|
-
entry_id: entryId,
|
|
65
|
-
content: 'Updated content',
|
|
66
|
-
entry_type: 'bug_fix',
|
|
67
|
-
tags: ['new-tag'],
|
|
68
|
-
},
|
|
69
|
-
personalDb,
|
|
70
|
-
undefined,
|
|
71
|
-
undefined,
|
|
72
|
-
undefined,
|
|
73
|
-
undefined,
|
|
74
|
-
teamDb
|
|
75
|
-
)) as any
|
|
76
|
-
|
|
77
|
-
expect(updateResult.success).toBe(true)
|
|
78
|
-
expect(updateResult.entry.content).toBe('Updated content')
|
|
79
|
-
expect(updateResult.entry.entryType).toBe('bug_fix')
|
|
80
|
-
expect(updateResult.entry.tags).toEqual(['new-tag'])
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
it('should return error if team DB is not configured', async () => {
|
|
84
|
-
const result = (await callTool(
|
|
85
|
-
'team_update_entry',
|
|
86
|
-
{ entry_id: 999, content: 'test' },
|
|
87
|
-
personalDb
|
|
88
|
-
)) as any
|
|
89
|
-
|
|
90
|
-
expect(result.success).toBe(false)
|
|
91
|
-
expect(result.error).toContain('Team database not configured')
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
it('should return error if entry is not found', async () => {
|
|
95
|
-
const result = (await callTool(
|
|
96
|
-
'team_update_entry',
|
|
97
|
-
{ entry_id: 9999, content: 'test' },
|
|
98
|
-
personalDb,
|
|
99
|
-
undefined,
|
|
100
|
-
undefined,
|
|
101
|
-
undefined,
|
|
102
|
-
undefined,
|
|
103
|
-
teamDb
|
|
104
|
-
)) as any
|
|
105
|
-
|
|
106
|
-
expect(result.success).toBe(false)
|
|
107
|
-
expect(result.error).toContain('Team entry 9999 not found')
|
|
108
|
-
expect(result.code).toBe('RESOURCE_NOT_FOUND')
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
describe('team_delete_entry', () => {
|
|
113
|
-
it('should soft-delete an existing team entry', async () => {
|
|
114
|
-
const createResult = (await callTool(
|
|
115
|
-
'team_create_entry',
|
|
116
|
-
{ content: 'To be deleted' },
|
|
117
|
-
personalDb,
|
|
118
|
-
undefined,
|
|
119
|
-
undefined,
|
|
120
|
-
undefined,
|
|
121
|
-
undefined,
|
|
122
|
-
teamDb
|
|
123
|
-
)) as any
|
|
124
|
-
|
|
125
|
-
const entryId = createResult.entry.id
|
|
126
|
-
|
|
127
|
-
const deleteResult = (await callTool(
|
|
128
|
-
'team_delete_entry',
|
|
129
|
-
{ entry_id: entryId },
|
|
130
|
-
personalDb,
|
|
131
|
-
undefined,
|
|
132
|
-
undefined,
|
|
133
|
-
undefined,
|
|
134
|
-
undefined,
|
|
135
|
-
teamDb
|
|
136
|
-
)) as any
|
|
137
|
-
|
|
138
|
-
expect(deleteResult.success).toBe(true)
|
|
139
|
-
expect(deleteResult.message).toContain('soft-deleted')
|
|
140
|
-
|
|
141
|
-
// Verify it cannot be updated
|
|
142
|
-
const updateResult = (await callTool(
|
|
143
|
-
'team_update_entry',
|
|
144
|
-
{ entry_id: entryId, content: 'Cannot update deleted' },
|
|
145
|
-
personalDb,
|
|
146
|
-
undefined,
|
|
147
|
-
undefined,
|
|
148
|
-
undefined,
|
|
149
|
-
undefined,
|
|
150
|
-
teamDb
|
|
151
|
-
)) as any
|
|
152
|
-
|
|
153
|
-
expect(updateResult.success).toBe(false)
|
|
154
|
-
expect(updateResult.error).toContain('not found')
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
it('should return error if team DB is not configured', async () => {
|
|
158
|
-
const result = (await callTool(
|
|
159
|
-
'team_delete_entry',
|
|
160
|
-
{ entry_id: 999 },
|
|
161
|
-
personalDb
|
|
162
|
-
)) as any
|
|
163
|
-
|
|
164
|
-
expect(result.success).toBe(false)
|
|
165
|
-
expect(result.error).toContain('Team database not configured')
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
it('should return error if entry is not found', async () => {
|
|
169
|
-
const result = (await callTool(
|
|
170
|
-
'team_delete_entry',
|
|
171
|
-
{ entry_id: 9999 },
|
|
172
|
-
personalDb,
|
|
173
|
-
undefined,
|
|
174
|
-
undefined,
|
|
175
|
-
undefined,
|
|
176
|
-
undefined,
|
|
177
|
-
teamDb
|
|
178
|
-
)) as any
|
|
179
|
-
|
|
180
|
-
expect(result.success).toBe(false)
|
|
181
|
-
expect(result.error).toContain('not found')
|
|
182
|
-
})
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
describe('team_merge_tags', () => {
|
|
186
|
-
it('should merge source tag into target tag for team entries', async () => {
|
|
187
|
-
// Create entries with source tag
|
|
188
|
-
await callTool(
|
|
189
|
-
'team_create_entry',
|
|
190
|
-
{ content: '1', tags: ['merge-source-tag'] },
|
|
191
|
-
personalDb,
|
|
192
|
-
undefined,
|
|
193
|
-
undefined,
|
|
194
|
-
undefined,
|
|
195
|
-
undefined,
|
|
196
|
-
teamDb
|
|
197
|
-
)
|
|
198
|
-
await callTool(
|
|
199
|
-
'team_create_entry',
|
|
200
|
-
{ content: '2', tags: ['merge-source-tag', 'other-tag'] },
|
|
201
|
-
personalDb,
|
|
202
|
-
undefined,
|
|
203
|
-
undefined,
|
|
204
|
-
undefined,
|
|
205
|
-
undefined,
|
|
206
|
-
teamDb
|
|
207
|
-
)
|
|
208
|
-
await callTool(
|
|
209
|
-
'team_create_entry',
|
|
210
|
-
{ content: '3', tags: ['merge-target-tag'] },
|
|
211
|
-
personalDb,
|
|
212
|
-
undefined,
|
|
213
|
-
undefined,
|
|
214
|
-
undefined,
|
|
215
|
-
undefined,
|
|
216
|
-
teamDb
|
|
217
|
-
)
|
|
218
|
-
|
|
219
|
-
const mergeResult = (await callTool(
|
|
220
|
-
'team_merge_tags',
|
|
221
|
-
{ source_tag: 'merge-source-tag', target_tag: 'merge-target-tag' },
|
|
222
|
-
personalDb,
|
|
223
|
-
undefined,
|
|
224
|
-
undefined,
|
|
225
|
-
undefined,
|
|
226
|
-
undefined,
|
|
227
|
-
teamDb
|
|
228
|
-
)) as any
|
|
229
|
-
|
|
230
|
-
expect(mergeResult.success).toBe(true)
|
|
231
|
-
expect(mergeResult.entriesUpdated).toBeGreaterThanOrEqual(2)
|
|
232
|
-
expect(mergeResult.sourceDeleted).toBe(true)
|
|
233
|
-
|
|
234
|
-
// Verify search by source tag returns empty
|
|
235
|
-
const searchSource = (await callTool(
|
|
236
|
-
'team_search',
|
|
237
|
-
{ tags: ['merge-source-tag'] },
|
|
238
|
-
personalDb,
|
|
239
|
-
undefined,
|
|
240
|
-
undefined,
|
|
241
|
-
undefined,
|
|
242
|
-
undefined,
|
|
243
|
-
teamDb
|
|
244
|
-
)) as any
|
|
245
|
-
|
|
246
|
-
expect(searchSource.count).toBe(0)
|
|
247
|
-
|
|
248
|
-
// Verify search by target tag returns at least 3
|
|
249
|
-
const searchTarget = (await callTool(
|
|
250
|
-
'team_search',
|
|
251
|
-
{ tags: ['merge-target-tag'] },
|
|
252
|
-
personalDb,
|
|
253
|
-
undefined,
|
|
254
|
-
undefined,
|
|
255
|
-
undefined,
|
|
256
|
-
undefined,
|
|
257
|
-
teamDb
|
|
258
|
-
)) as any
|
|
259
|
-
|
|
260
|
-
expect(searchTarget.count).toBeGreaterThanOrEqual(3)
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
it('should return error if source and target are the same', async () => {
|
|
264
|
-
const result = (await callTool(
|
|
265
|
-
'team_merge_tags',
|
|
266
|
-
{ source_tag: 'same-tag', target_tag: 'same-tag' },
|
|
267
|
-
personalDb,
|
|
268
|
-
undefined,
|
|
269
|
-
undefined,
|
|
270
|
-
undefined,
|
|
271
|
-
undefined,
|
|
272
|
-
teamDb
|
|
273
|
-
)) as any
|
|
274
|
-
|
|
275
|
-
expect(result.success).toBe(false)
|
|
276
|
-
expect(result.error).toContain('must be different')
|
|
277
|
-
expect(result.code).toBe('VALIDATION_ERROR')
|
|
278
|
-
})
|
|
279
|
-
|
|
280
|
-
it('should return error if team DB is not configured', async () => {
|
|
281
|
-
const result = (await callTool(
|
|
282
|
-
'team_merge_tags',
|
|
283
|
-
{ source_tag: 'a', target_tag: 'b' },
|
|
284
|
-
personalDb
|
|
285
|
-
)) as any
|
|
286
|
-
|
|
287
|
-
expect(result.success).toBe(false)
|
|
288
|
-
expect(result.error).toContain('Team database not configured')
|
|
289
|
-
})
|
|
290
|
-
})
|
|
291
|
-
})
|