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,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool Annotations Invariant Test
|
|
3
|
-
*
|
|
4
|
-
* Structural enforcement: verifies every tool has proper annotations
|
|
5
|
-
* with explicit readOnlyHint and openWorldHint, plus a valid title.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { describe, it, expect } from 'vitest'
|
|
9
|
-
import { getTools } from '../../src/handlers/tools/index.js'
|
|
10
|
-
import { DatabaseAdapterFactory } from '../../src/database/adapter-factory.js'
|
|
11
|
-
import path from 'node:path'
|
|
12
|
-
import os from 'node:os'
|
|
13
|
-
import fs from 'node:fs'
|
|
14
|
-
|
|
15
|
-
describe('Tool Annotations Invariant', () => {
|
|
16
|
-
// Create a temporary database for tool registration
|
|
17
|
-
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mj-invariant-'))
|
|
18
|
-
const dbPath = path.join(tmpDir, 'test-invariants.db')
|
|
19
|
-
|
|
20
|
-
let tools: ReturnType<typeof getTools>
|
|
21
|
-
|
|
22
|
-
// Build the tool list once
|
|
23
|
-
it('should load all tools', async () => {
|
|
24
|
-
const db = await DatabaseAdapterFactory.create(dbPath)
|
|
25
|
-
await db.initialize()
|
|
26
|
-
tools = getTools(db, null)
|
|
27
|
-
expect(tools.length).toBeGreaterThan(0)
|
|
28
|
-
db.close()
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('every tool must have annotations', () => {
|
|
32
|
-
for (const tool of tools) {
|
|
33
|
-
expect(tool.annotations, `Tool "${tool.name}" is missing annotations`).toBeDefined()
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('every tool must have an explicit readOnlyHint', () => {
|
|
38
|
-
for (const tool of tools) {
|
|
39
|
-
expect(
|
|
40
|
-
tool.annotations?.readOnlyHint,
|
|
41
|
-
`Tool "${tool.name}" is missing readOnlyHint`
|
|
42
|
-
).toBeDefined()
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
it('every tool must have an explicit openWorldHint', () => {
|
|
47
|
-
for (const tool of tools) {
|
|
48
|
-
expect(
|
|
49
|
-
tool.annotations?.openWorldHint,
|
|
50
|
-
`Tool "${tool.name}" is missing openWorldHint`
|
|
51
|
-
).toBeDefined()
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
it('every tool must have a non-empty name', () => {
|
|
56
|
-
for (const tool of tools) {
|
|
57
|
-
expect(tool.name.length).toBeGreaterThan(0)
|
|
58
|
-
expect(tool.name.length).toBeLessThanOrEqual(128)
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
it('tool names must be unique', () => {
|
|
63
|
-
const names = tools.map((t) => t.name)
|
|
64
|
-
expect(new Set(names).size).toBe(names.length)
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
it('0 tools should be missing openWorldHint', () => {
|
|
68
|
-
const missing = tools.filter((t) => t.annotations?.openWorldHint === undefined)
|
|
69
|
-
expect(
|
|
70
|
-
missing.length,
|
|
71
|
-
`Tools missing openWorldHint: ${missing.map((t) => t.name).join(', ')}`
|
|
72
|
-
).toBe(0)
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
it('every tool must have a non-empty title', () => {
|
|
76
|
-
for (const tool of tools) {
|
|
77
|
-
expect(tool.title, `Tool "${tool.name}" is missing title`).toBeTruthy()
|
|
78
|
-
expect(tool.title!.length).toBeGreaterThan(0)
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
// Cleanup
|
|
83
|
-
it('cleanup', () => {
|
|
84
|
-
try {
|
|
85
|
-
fs.rmSync(tmpDir, { recursive: true })
|
|
86
|
-
} catch {
|
|
87
|
-
// Best-effort cleanup
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
})
|
|
@@ -1,514 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool Handler Coverage Tests
|
|
3
|
-
*
|
|
4
|
-
* Additional tests for uncovered code paths in:
|
|
5
|
-
* - admin.ts (update_entry not found, vectorManager, merge_tags errors)
|
|
6
|
-
* - relationships.ts (duplicate link, invalid type, tag filtering, no entries)
|
|
7
|
-
* - backup.ts (restore_backup, cleanup_backups)
|
|
8
|
-
* - analytics.ts (date ranges, project_breakdown, error branches)
|
|
9
|
-
* - core.ts (create_entry with teamDb sharing, auto-context, Zod errors)
|
|
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
|
-
import type { VectorSearchManager } from '../../src/vector/vector-search-manager.js'
|
|
16
|
-
|
|
17
|
-
function createMockVector(overrides: Partial<Record<string, unknown>> = {}): VectorSearchManager {
|
|
18
|
-
const defaults = {
|
|
19
|
-
isInitialized: vi.fn().mockReturnValue(true),
|
|
20
|
-
initialize: vi.fn().mockResolvedValue(undefined),
|
|
21
|
-
search: vi.fn().mockResolvedValue([]),
|
|
22
|
-
addEntry: vi.fn().mockResolvedValue(true),
|
|
23
|
-
removeEntry: vi.fn().mockResolvedValue(true),
|
|
24
|
-
rebuildIndex: vi.fn().mockResolvedValue(5),
|
|
25
|
-
getStats: vi.fn().mockResolvedValue({
|
|
26
|
-
itemCount: 10,
|
|
27
|
-
modelName: 'Xenova/all-MiniLM-L6-v2',
|
|
28
|
-
dimensions: 384,
|
|
29
|
-
}),
|
|
30
|
-
generateEmbedding: vi.fn().mockResolvedValue(new Array(384).fill(0)),
|
|
31
|
-
}
|
|
32
|
-
return { ...defaults, ...overrides } as unknown as VectorSearchManager
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
describe('Tool Handler Coverage', () => {
|
|
36
|
-
let db: DatabaseAdapter
|
|
37
|
-
let teamDb: DatabaseAdapter
|
|
38
|
-
const testDbPath = './test-tool-cov.db'
|
|
39
|
-
const teamDbPath = './test-tool-team-cov.db'
|
|
40
|
-
|
|
41
|
-
beforeAll(async () => {
|
|
42
|
-
db = new DatabaseAdapter(testDbPath)
|
|
43
|
-
await db.initialize()
|
|
44
|
-
teamDb = new DatabaseAdapter(teamDbPath)
|
|
45
|
-
await teamDb.initialize()
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
afterAll(() => {
|
|
49
|
-
db.close()
|
|
50
|
-
teamDb.close()
|
|
51
|
-
try {
|
|
52
|
-
const fs = require('node:fs')
|
|
53
|
-
for (const p of [testDbPath, teamDbPath]) {
|
|
54
|
-
if (fs.existsSync(p)) fs.unlinkSync(p)
|
|
55
|
-
}
|
|
56
|
-
} catch {
|
|
57
|
-
// Ignore cleanup errors
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
// ========================================================================
|
|
62
|
-
// admin.ts — update_entry
|
|
63
|
-
// ========================================================================
|
|
64
|
-
|
|
65
|
-
describe('update_entry - coverage', () => {
|
|
66
|
-
it('should return error for nonexistent entry', async () => {
|
|
67
|
-
const result = (await callTool(
|
|
68
|
-
'update_entry',
|
|
69
|
-
{ entry_id: 99999, content: 'Updated' },
|
|
70
|
-
db
|
|
71
|
-
)) as { success: boolean; error: string }
|
|
72
|
-
|
|
73
|
-
expect(result.success).toBe(false)
|
|
74
|
-
expect(result.error).toContain('not found')
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
it('should re-index when content changes and vectorManager present', async () => {
|
|
78
|
-
const entry = db.createEntry({ content: 'To be updated with vector' })
|
|
79
|
-
const vectorManager = createMockVector()
|
|
80
|
-
|
|
81
|
-
const result = (await callTool(
|
|
82
|
-
'update_entry',
|
|
83
|
-
{ entry_id: entry.id, content: 'Updated content with vector' },
|
|
84
|
-
db,
|
|
85
|
-
vectorManager
|
|
86
|
-
)) as { success: boolean; entry: { content: string } }
|
|
87
|
-
|
|
88
|
-
expect(result.success).toBe(true)
|
|
89
|
-
expect(result.entry.content).toBe('Updated content with vector')
|
|
90
|
-
// vectorManager.addEntry should have been called
|
|
91
|
-
expect(vectorManager.addEntry).toHaveBeenCalled()
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
it('should handle invalid entry_type with Zod error', async () => {
|
|
95
|
-
const entry = db.createEntry({ content: 'For invalid type test' })
|
|
96
|
-
const result = (await callTool(
|
|
97
|
-
'update_entry',
|
|
98
|
-
{ entry_id: entry.id, entry_type: 'completely_invalid_type' },
|
|
99
|
-
db
|
|
100
|
-
)) as { error: string }
|
|
101
|
-
|
|
102
|
-
expect(result.error).toBeDefined()
|
|
103
|
-
})
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
// ========================================================================
|
|
107
|
-
// admin.ts — delete_entry with vectorManager
|
|
108
|
-
// ========================================================================
|
|
109
|
-
|
|
110
|
-
describe('delete_entry - coverage', () => {
|
|
111
|
-
it('should remove from vector index on delete', async () => {
|
|
112
|
-
const entry = db.createEntry({ content: 'Delete with vector' })
|
|
113
|
-
const vectorManager = createMockVector()
|
|
114
|
-
|
|
115
|
-
const result = (await callTool(
|
|
116
|
-
'delete_entry',
|
|
117
|
-
{ entry_id: entry.id },
|
|
118
|
-
db,
|
|
119
|
-
vectorManager
|
|
120
|
-
)) as { success: boolean }
|
|
121
|
-
|
|
122
|
-
expect(result.success).toBe(true)
|
|
123
|
-
expect(vectorManager.removeEntry).toHaveBeenCalledWith(entry.id)
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
it('should handle permanent delete', async () => {
|
|
127
|
-
const entry = db.createEntry({ content: 'Permanent delete test' })
|
|
128
|
-
const result = (await callTool(
|
|
129
|
-
'delete_entry',
|
|
130
|
-
{ entry_id: entry.id, permanent: true },
|
|
131
|
-
db
|
|
132
|
-
)) as { success: boolean; permanent: boolean }
|
|
133
|
-
|
|
134
|
-
expect(result.success).toBe(true)
|
|
135
|
-
expect(result.permanent).toBe(true)
|
|
136
|
-
})
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
// ========================================================================
|
|
140
|
-
// admin.ts — merge_tags
|
|
141
|
-
// ========================================================================
|
|
142
|
-
|
|
143
|
-
describe('merge_tags - coverage', () => {
|
|
144
|
-
it('should return error when source equals target', async () => {
|
|
145
|
-
const result = (await callTool(
|
|
146
|
-
'merge_tags',
|
|
147
|
-
{ source_tag: 'same', target_tag: 'same' },
|
|
148
|
-
db
|
|
149
|
-
)) as { success: boolean; error: string }
|
|
150
|
-
|
|
151
|
-
expect(result.success).toBe(false)
|
|
152
|
-
expect(result.error).toContain('different')
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
it('should return error for nonexistent source tag', async () => {
|
|
156
|
-
const result = (await callTool(
|
|
157
|
-
'merge_tags',
|
|
158
|
-
{ source_tag: 'nonexistent_src_xyz', target_tag: 'nonexistent_tgt_xyz' },
|
|
159
|
-
db
|
|
160
|
-
)) as { success: boolean; error: string }
|
|
161
|
-
|
|
162
|
-
// mergeTags throws "Tag not found" for nonexistent source
|
|
163
|
-
expect(result.success).toBe(false)
|
|
164
|
-
expect(result.error).toContain('Tag not found: nonexistent_src_xyz')
|
|
165
|
-
})
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
// ========================================================================
|
|
169
|
-
// relationships.ts — link_entries edge cases
|
|
170
|
-
// ========================================================================
|
|
171
|
-
|
|
172
|
-
describe('link_entries - coverage', () => {
|
|
173
|
-
it('should return duplicate when relationship already exists', async () => {
|
|
174
|
-
const e1 = db.createEntry({ content: 'Link source dup' })
|
|
175
|
-
const e2 = db.createEntry({ content: 'Link target dup' })
|
|
176
|
-
|
|
177
|
-
// Create first
|
|
178
|
-
await callTool(
|
|
179
|
-
'link_entries',
|
|
180
|
-
{
|
|
181
|
-
from_entry_id: e1.id,
|
|
182
|
-
to_entry_id: e2.id,
|
|
183
|
-
relationship_type: 'references',
|
|
184
|
-
},
|
|
185
|
-
db
|
|
186
|
-
)
|
|
187
|
-
|
|
188
|
-
// Create duplicate
|
|
189
|
-
const result = (await callTool(
|
|
190
|
-
'link_entries',
|
|
191
|
-
{
|
|
192
|
-
from_entry_id: e1.id,
|
|
193
|
-
to_entry_id: e2.id,
|
|
194
|
-
relationship_type: 'references',
|
|
195
|
-
},
|
|
196
|
-
db
|
|
197
|
-
)) as { success: boolean; duplicate: boolean; message: string }
|
|
198
|
-
|
|
199
|
-
expect(result.success).toBe(true)
|
|
200
|
-
expect(result.duplicate).toBe(true)
|
|
201
|
-
expect(result.message).toContain('already exists')
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
it('should return Zod error for invalid relationship_type', async () => {
|
|
205
|
-
const result = (await callTool(
|
|
206
|
-
'link_entries',
|
|
207
|
-
{
|
|
208
|
-
from_entry_id: 1,
|
|
209
|
-
to_entry_id: 2,
|
|
210
|
-
relationship_type: 'invalid_type_xyz',
|
|
211
|
-
},
|
|
212
|
-
db
|
|
213
|
-
)) as { success: boolean; message?: string; error?: string }
|
|
214
|
-
|
|
215
|
-
// Should return an error (Zod or domain)
|
|
216
|
-
expect(result.success === false || result.error !== undefined).toBe(true)
|
|
217
|
-
})
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
// ========================================================================
|
|
221
|
-
// relationships.ts — visualize_relationships edge cases
|
|
222
|
-
// ========================================================================
|
|
223
|
-
|
|
224
|
-
describe('visualize_relationships - coverage', () => {
|
|
225
|
-
it('should return no entries for nonexistent entry_id', async () => {
|
|
226
|
-
const result = (await callTool('visualize_relationships', { entry_id: 99999 }, db)) as {
|
|
227
|
-
entry_count: number
|
|
228
|
-
mermaid: null
|
|
229
|
-
message: string
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
expect(result.entry_count).toBe(0)
|
|
233
|
-
expect(result.mermaid).toBeNull()
|
|
234
|
-
expect(result.message).toContain('not found')
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
it('should filter by tags', async () => {
|
|
238
|
-
const e1 = db.createEntry({ content: 'Tag viz entry', tags: ['viz-tag1'] })
|
|
239
|
-
const e2 = db.createEntry({ content: 'Tag viz entry 2', tags: ['viz-tag1'] })
|
|
240
|
-
await callTool(
|
|
241
|
-
'link_entries',
|
|
242
|
-
{
|
|
243
|
-
from_entry_id: e1.id,
|
|
244
|
-
to_entry_id: e2.id,
|
|
245
|
-
relationship_type: 'references',
|
|
246
|
-
},
|
|
247
|
-
db
|
|
248
|
-
)
|
|
249
|
-
|
|
250
|
-
const result = (await callTool(
|
|
251
|
-
'visualize_relationships',
|
|
252
|
-
{ tags: ['viz-tag1'] },
|
|
253
|
-
db
|
|
254
|
-
)) as { entry_count: number; mermaid: string | null }
|
|
255
|
-
|
|
256
|
-
expect(result.entry_count).toBeGreaterThan(0)
|
|
257
|
-
})
|
|
258
|
-
|
|
259
|
-
it('should show all relationship entries when no filters', async () => {
|
|
260
|
-
const result = (await callTool('visualize_relationships', {}, db)) as {
|
|
261
|
-
entry_count: number
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Should return entries that have relationships
|
|
265
|
-
expect(result.entry_count).toBeGreaterThanOrEqual(0)
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
it('should handle entries with tags but no relationships', async () => {
|
|
269
|
-
db.createEntry({ content: 'Isolated tag entry', tags: ['isolated-tag-xyz'] })
|
|
270
|
-
|
|
271
|
-
const result = (await callTool(
|
|
272
|
-
'visualize_relationships',
|
|
273
|
-
{ tags: ['isolated-tag-xyz'] },
|
|
274
|
-
db
|
|
275
|
-
)) as { entry_count: number; relationship_count: number }
|
|
276
|
-
|
|
277
|
-
// Entry is found by tag query, but has 0 relationships
|
|
278
|
-
expect(result.entry_count).toBeGreaterThanOrEqual(1)
|
|
279
|
-
expect(result.relationship_count).toBe(0)
|
|
280
|
-
})
|
|
281
|
-
})
|
|
282
|
-
|
|
283
|
-
// ========================================================================
|
|
284
|
-
// backup.ts — restore_backup, cleanup_backups
|
|
285
|
-
// ========================================================================
|
|
286
|
-
|
|
287
|
-
describe('restore_backup - coverage', () => {
|
|
288
|
-
it('should return error for nonexistent backup', async () => {
|
|
289
|
-
const result = (await callTool(
|
|
290
|
-
'restore_backup',
|
|
291
|
-
{ filename: 'nonexistent_backup.db' },
|
|
292
|
-
db
|
|
293
|
-
)) as { success: boolean; error?: string; message?: string }
|
|
294
|
-
|
|
295
|
-
expect(result.success).toBe(false)
|
|
296
|
-
})
|
|
297
|
-
})
|
|
298
|
-
|
|
299
|
-
describe('cleanup_backups - coverage', () => {
|
|
300
|
-
it('should clean up old backups', async () => {
|
|
301
|
-
const result = (await callTool('cleanup_backups', { keep_count: 5 }, db)) as {
|
|
302
|
-
success: boolean
|
|
303
|
-
message: string
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
expect(result.success).toBe(true)
|
|
307
|
-
expect(result.message).toBeDefined()
|
|
308
|
-
})
|
|
309
|
-
})
|
|
310
|
-
|
|
311
|
-
// ========================================================================
|
|
312
|
-
// analytics.ts — get_statistics
|
|
313
|
-
// ========================================================================
|
|
314
|
-
|
|
315
|
-
describe('get_statistics - coverage', () => {
|
|
316
|
-
it('should support group_by month', async () => {
|
|
317
|
-
const result = (await callTool('get_statistics', { group_by: 'month' }, db)) as {
|
|
318
|
-
groupBy: string
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
expect(result.groupBy).toBe('month')
|
|
322
|
-
})
|
|
323
|
-
|
|
324
|
-
it('should filter by date range', async () => {
|
|
325
|
-
const today = new Date().toISOString().split('T')[0]!
|
|
326
|
-
const allStats = (await callTool('get_statistics', {}, db)) as {
|
|
327
|
-
totalEntries: number
|
|
328
|
-
}
|
|
329
|
-
const filteredStats = (await callTool(
|
|
330
|
-
'get_statistics',
|
|
331
|
-
{ start_date: today, end_date: today },
|
|
332
|
-
db
|
|
333
|
-
)) as { totalEntries: number; dateRange: { startDate: string; endDate: string } }
|
|
334
|
-
|
|
335
|
-
// Filtered count should be <= all entries
|
|
336
|
-
expect(filteredStats.totalEntries).toBeLessThanOrEqual(allStats.totalEntries)
|
|
337
|
-
expect(filteredStats.totalEntries).toBeGreaterThanOrEqual(0)
|
|
338
|
-
// dateRange should echo back the applied dates
|
|
339
|
-
expect(filteredStats.dateRange).toBeDefined()
|
|
340
|
-
expect(filteredStats.dateRange.startDate).toBe(today)
|
|
341
|
-
expect(filteredStats.dateRange.endDate).toBe(today)
|
|
342
|
-
})
|
|
343
|
-
|
|
344
|
-
it('should return 0 entries for future date range', async () => {
|
|
345
|
-
const result = (await callTool(
|
|
346
|
-
'get_statistics',
|
|
347
|
-
{ start_date: '2099-01-01', end_date: '2099-12-31' },
|
|
348
|
-
db
|
|
349
|
-
)) as { totalEntries: number; dateRange: { startDate: string; endDate: string } }
|
|
350
|
-
|
|
351
|
-
expect(result.totalEntries).toBe(0)
|
|
352
|
-
expect(result.dateRange.startDate).toBe('2099-01-01')
|
|
353
|
-
})
|
|
354
|
-
|
|
355
|
-
it('should return project_breakdown when requested', async () => {
|
|
356
|
-
// Create entry with a known project number
|
|
357
|
-
db.createEntry({ content: 'Project breakdown test', projectNumber: 777 })
|
|
358
|
-
|
|
359
|
-
const result = (await callTool('get_statistics', { project_breakdown: true }, db)) as {
|
|
360
|
-
totalEntries: number
|
|
361
|
-
projectBreakdown: { project_number: number; entry_count: number }[]
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
expect(result.totalEntries).toBeGreaterThan(0)
|
|
365
|
-
expect(result.projectBreakdown).toBeDefined()
|
|
366
|
-
expect(Array.isArray(result.projectBreakdown)).toBe(true)
|
|
367
|
-
const proj777 = result.projectBreakdown.find((p) => p.project_number === 777)
|
|
368
|
-
expect(proj777).toBeDefined()
|
|
369
|
-
expect(proj777!.entry_count).toBeGreaterThanOrEqual(1)
|
|
370
|
-
})
|
|
371
|
-
|
|
372
|
-
it('should NOT return project_breakdown when not requested', async () => {
|
|
373
|
-
const result = (await callTool('get_statistics', {}, db)) as {
|
|
374
|
-
projectBreakdown?: unknown
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
expect(result.projectBreakdown).toBeUndefined()
|
|
378
|
-
})
|
|
379
|
-
|
|
380
|
-
it('should NOT return dateRange when no dates provided', async () => {
|
|
381
|
-
const result = (await callTool('get_statistics', {}, db)) as {
|
|
382
|
-
dateRange?: unknown
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
expect(result.dateRange).toBeUndefined()
|
|
386
|
-
})
|
|
387
|
-
|
|
388
|
-
it('should return error for invalid group_by', async () => {
|
|
389
|
-
const result = (await callTool('get_statistics', { group_by: 'invalid' }, db)) as {
|
|
390
|
-
error?: string
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
// Should return Zod validation error
|
|
394
|
-
expect(result.error).toBeDefined()
|
|
395
|
-
})
|
|
396
|
-
})
|
|
397
|
-
|
|
398
|
-
// ========================================================================
|
|
399
|
-
// analytics.ts — get_cross_project_insights
|
|
400
|
-
// ========================================================================
|
|
401
|
-
|
|
402
|
-
describe('get_cross_project_insights - coverage', () => {
|
|
403
|
-
it('should support date range filter', async () => {
|
|
404
|
-
const today = new Date().toISOString().split('T')[0]!
|
|
405
|
-
const result = (await callTool(
|
|
406
|
-
'get_cross_project_insights',
|
|
407
|
-
{
|
|
408
|
-
min_entries: 1,
|
|
409
|
-
start_date: today,
|
|
410
|
-
end_date: today,
|
|
411
|
-
},
|
|
412
|
-
db
|
|
413
|
-
)) as { project_count: number }
|
|
414
|
-
|
|
415
|
-
expect(result.project_count).toBeGreaterThanOrEqual(0)
|
|
416
|
-
})
|
|
417
|
-
})
|
|
418
|
-
|
|
419
|
-
// ========================================================================
|
|
420
|
-
// core.ts — create_entry with team sharing
|
|
421
|
-
// ========================================================================
|
|
422
|
-
|
|
423
|
-
describe('create_entry - team sharing coverage', () => {
|
|
424
|
-
it('should attempt team sharing when share_with_team is true', async () => {
|
|
425
|
-
const result = (await callTool(
|
|
426
|
-
'create_entry',
|
|
427
|
-
{
|
|
428
|
-
content: 'Team shared entry test',
|
|
429
|
-
share_with_team: true,
|
|
430
|
-
is_personal: false,
|
|
431
|
-
},
|
|
432
|
-
db,
|
|
433
|
-
undefined,
|
|
434
|
-
undefined,
|
|
435
|
-
undefined,
|
|
436
|
-
undefined,
|
|
437
|
-
teamDb
|
|
438
|
-
)) as { success: boolean; sharedWithTeam?: boolean }
|
|
439
|
-
|
|
440
|
-
// Entry is always created in personal DB regardless of team share outcome
|
|
441
|
-
expect(result.success).toBe(true)
|
|
442
|
-
// Team share may silently fail (missing author column in test schema)
|
|
443
|
-
// — the important thing is coverage of the share_with_team code path
|
|
444
|
-
})
|
|
445
|
-
|
|
446
|
-
it('should not share when no teamDb', async () => {
|
|
447
|
-
const result = (await callTool(
|
|
448
|
-
'create_entry',
|
|
449
|
-
{
|
|
450
|
-
content: 'No team entry test',
|
|
451
|
-
share_with_team: true,
|
|
452
|
-
},
|
|
453
|
-
db
|
|
454
|
-
)) as { success: boolean; sharedWithTeam?: boolean }
|
|
455
|
-
|
|
456
|
-
expect(result.success).toBe(true)
|
|
457
|
-
// No teamDb, so sharedWithTeam shouldn't be present
|
|
458
|
-
expect(result.sharedWithTeam).toBeUndefined()
|
|
459
|
-
})
|
|
460
|
-
})
|
|
461
|
-
|
|
462
|
-
// ========================================================================
|
|
463
|
-
// core.ts — create_entry Zod errors
|
|
464
|
-
// ========================================================================
|
|
465
|
-
|
|
466
|
-
describe('create_entry - Zod errors', () => {
|
|
467
|
-
it('should return error for invalid entry_type', async () => {
|
|
468
|
-
const result = (await callTool(
|
|
469
|
-
'create_entry',
|
|
470
|
-
{ content: 'Test', entry_type: 'invalid_type_xyz' },
|
|
471
|
-
db
|
|
472
|
-
)) as { error: string }
|
|
473
|
-
|
|
474
|
-
expect(result.error).toBeDefined()
|
|
475
|
-
})
|
|
476
|
-
|
|
477
|
-
it('should return error for invalid significance_type', async () => {
|
|
478
|
-
const result = (await callTool(
|
|
479
|
-
'create_entry',
|
|
480
|
-
{ content: 'Test', significance_type: 'invalid_sig' },
|
|
481
|
-
db
|
|
482
|
-
)) as { error: string }
|
|
483
|
-
|
|
484
|
-
expect(result.error).toBeDefined()
|
|
485
|
-
})
|
|
486
|
-
|
|
487
|
-
it('should return error for empty content', async () => {
|
|
488
|
-
const result = (await callTool('create_entry', { content: '' }, db)) as {
|
|
489
|
-
error: string
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
expect(result.error).toBeDefined()
|
|
493
|
-
})
|
|
494
|
-
})
|
|
495
|
-
|
|
496
|
-
// ========================================================================
|
|
497
|
-
// core.ts — get_entry_by_id without relationships
|
|
498
|
-
// ========================================================================
|
|
499
|
-
|
|
500
|
-
describe('get_entry_by_id - coverage', () => {
|
|
501
|
-
it('should return entry without relationships when include_relationships is false', async () => {
|
|
502
|
-
const entry = db.createEntry({ content: 'No relationships entry' })
|
|
503
|
-
|
|
504
|
-
const result = (await callTool(
|
|
505
|
-
'get_entry_by_id',
|
|
506
|
-
{ entry_id: entry.id, include_relationships: false },
|
|
507
|
-
db
|
|
508
|
-
)) as { entry: { id: number }; relationships?: unknown[] }
|
|
509
|
-
|
|
510
|
-
expect(result.entry.id).toBe(entry.id)
|
|
511
|
-
expect(result.relationships).toBeUndefined()
|
|
512
|
-
})
|
|
513
|
-
})
|
|
514
|
-
})
|