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.
Files changed (291) hide show
  1. package/.github/workflows/codeql.yml +1 -6
  2. package/.github/workflows/docker-publish.yml +15 -49
  3. package/.github/workflows/lint-and-test.yml +1 -1
  4. package/.github/workflows/secrets-scanning.yml +4 -3
  5. package/.github/workflows/security-update.yml +3 -3
  6. package/CHANGELOG.md +213 -0
  7. package/CONTRIBUTING.md +132 -97
  8. package/DOCKER_README.md +184 -235
  9. package/Dockerfile +27 -24
  10. package/README.md +218 -190
  11. package/SECURITY.md +27 -35
  12. package/dist/cli.js +16 -1
  13. package/dist/cli.js.map +1 -1
  14. package/dist/constants/ServerInstructions.d.ts +5 -1
  15. package/dist/constants/ServerInstructions.d.ts.map +1 -1
  16. package/dist/constants/ServerInstructions.js +133 -73
  17. package/dist/constants/ServerInstructions.js.map +1 -1
  18. package/dist/constants/icons.d.ts +2 -2
  19. package/dist/constants/icons.d.ts.map +1 -1
  20. package/dist/constants/icons.js +7 -6
  21. package/dist/constants/icons.js.map +1 -1
  22. package/dist/database/SqliteAdapter.d.ts +37 -24
  23. package/dist/database/SqliteAdapter.d.ts.map +1 -1
  24. package/dist/database/SqliteAdapter.js +319 -157
  25. package/dist/database/SqliteAdapter.js.map +1 -1
  26. package/dist/database/schema.d.ts +45 -0
  27. package/dist/database/schema.d.ts.map +1 -0
  28. package/dist/database/schema.js +92 -0
  29. package/dist/database/schema.js.map +1 -0
  30. package/dist/filtering/ToolFilter.d.ts +1 -1
  31. package/dist/filtering/ToolFilter.d.ts.map +1 -1
  32. package/dist/filtering/ToolFilter.js +13 -2
  33. package/dist/filtering/ToolFilter.js.map +1 -1
  34. package/dist/github/GitHubIntegration.d.ts.map +1 -1
  35. package/dist/github/GitHubIntegration.js +1 -3
  36. package/dist/github/GitHubIntegration.js.map +1 -1
  37. package/dist/handlers/prompts/github.d.ts +12 -0
  38. package/dist/handlers/prompts/github.d.ts.map +1 -0
  39. package/dist/handlers/prompts/github.js +178 -0
  40. package/dist/handlers/prompts/github.js.map +1 -0
  41. package/dist/handlers/prompts/index.d.ts +23 -2
  42. package/dist/handlers/prompts/index.d.ts.map +1 -1
  43. package/dist/handlers/prompts/index.js +7 -432
  44. package/dist/handlers/prompts/index.js.map +1 -1
  45. package/dist/handlers/prompts/workflow.d.ts +12 -0
  46. package/dist/handlers/prompts/workflow.d.ts.map +1 -0
  47. package/dist/handlers/prompts/workflow.js +277 -0
  48. package/dist/handlers/prompts/workflow.js.map +1 -0
  49. package/dist/handlers/resources/core.d.ts +11 -0
  50. package/dist/handlers/resources/core.d.ts.map +1 -0
  51. package/dist/handlers/resources/core.js +433 -0
  52. package/dist/handlers/resources/core.js.map +1 -0
  53. package/dist/handlers/resources/github.d.ts +11 -0
  54. package/dist/handlers/resources/github.d.ts.map +1 -0
  55. package/dist/handlers/resources/github.js +314 -0
  56. package/dist/handlers/resources/github.js.map +1 -0
  57. package/dist/handlers/resources/graph.d.ts +11 -0
  58. package/dist/handlers/resources/graph.d.ts.map +1 -0
  59. package/dist/handlers/resources/graph.js +204 -0
  60. package/dist/handlers/resources/graph.js.map +1 -0
  61. package/dist/handlers/resources/index.d.ts +5 -20
  62. package/dist/handlers/resources/index.d.ts.map +1 -1
  63. package/dist/handlers/resources/index.js +16 -1278
  64. package/dist/handlers/resources/index.js.map +1 -1
  65. package/dist/handlers/resources/shared.d.ts +60 -0
  66. package/dist/handlers/resources/shared.d.ts.map +1 -0
  67. package/dist/handlers/resources/shared.js +49 -0
  68. package/dist/handlers/resources/shared.js.map +1 -0
  69. package/dist/handlers/resources/team.d.ts +13 -0
  70. package/dist/handlers/resources/team.d.ts.map +1 -0
  71. package/dist/handlers/resources/team.js +119 -0
  72. package/dist/handlers/resources/team.js.map +1 -0
  73. package/dist/handlers/resources/templates.d.ts +13 -0
  74. package/dist/handlers/resources/templates.d.ts.map +1 -0
  75. package/dist/handlers/resources/templates.js +310 -0
  76. package/dist/handlers/resources/templates.js.map +1 -0
  77. package/dist/handlers/tools/admin.d.ts +8 -0
  78. package/dist/handlers/tools/admin.d.ts.map +1 -0
  79. package/dist/handlers/tools/admin.js +270 -0
  80. package/dist/handlers/tools/admin.js.map +1 -0
  81. package/dist/handlers/tools/analytics.d.ts +8 -0
  82. package/dist/handlers/tools/analytics.d.ts.map +1 -0
  83. package/dist/handlers/tools/analytics.js +256 -0
  84. package/dist/handlers/tools/analytics.js.map +1 -0
  85. package/dist/handlers/tools/backup.d.ts +8 -0
  86. package/dist/handlers/tools/backup.d.ts.map +1 -0
  87. package/dist/handlers/tools/backup.js +224 -0
  88. package/dist/handlers/tools/backup.js.map +1 -0
  89. package/dist/handlers/tools/core.d.ts +9 -0
  90. package/dist/handlers/tools/core.d.ts.map +1 -0
  91. package/dist/handlers/tools/core.js +326 -0
  92. package/dist/handlers/tools/core.js.map +1 -0
  93. package/dist/handlers/tools/export.d.ts +8 -0
  94. package/dist/handlers/tools/export.d.ts.map +1 -0
  95. package/dist/handlers/tools/export.js +89 -0
  96. package/dist/handlers/tools/export.js.map +1 -0
  97. package/dist/handlers/tools/github/helpers.d.ts +34 -0
  98. package/dist/handlers/tools/github/helpers.d.ts.map +1 -0
  99. package/dist/handlers/tools/github/helpers.js +52 -0
  100. package/dist/handlers/tools/github/helpers.js.map +1 -0
  101. package/dist/handlers/tools/github/insights-tools.d.ts +8 -0
  102. package/dist/handlers/tools/github/insights-tools.d.ts.map +1 -0
  103. package/dist/handlers/tools/github/insights-tools.js +104 -0
  104. package/dist/handlers/tools/github/insights-tools.js.map +1 -0
  105. package/dist/handlers/tools/github/issue-tools.d.ts +8 -0
  106. package/dist/handlers/tools/github/issue-tools.d.ts.map +1 -0
  107. package/dist/handlers/tools/github/issue-tools.js +359 -0
  108. package/dist/handlers/tools/github/issue-tools.js.map +1 -0
  109. package/dist/handlers/tools/github/kanban-tools.d.ts +8 -0
  110. package/dist/handlers/tools/github/kanban-tools.d.ts.map +1 -0
  111. package/dist/handlers/tools/github/kanban-tools.js +108 -0
  112. package/dist/handlers/tools/github/kanban-tools.js.map +1 -0
  113. package/dist/handlers/tools/github/milestone-tools.d.ts +9 -0
  114. package/dist/handlers/tools/github/milestone-tools.d.ts.map +1 -0
  115. package/dist/handlers/tools/github/milestone-tools.js +302 -0
  116. package/dist/handlers/tools/github/milestone-tools.js.map +1 -0
  117. package/dist/handlers/tools/github/mutation-tools.d.ts +12 -0
  118. package/dist/handlers/tools/github/mutation-tools.d.ts.map +1 -0
  119. package/dist/handlers/tools/github/mutation-tools.js +15 -0
  120. package/dist/handlers/tools/github/mutation-tools.js.map +1 -0
  121. package/dist/handlers/tools/github/read-tools.d.ts +8 -0
  122. package/dist/handlers/tools/github/read-tools.d.ts.map +1 -0
  123. package/dist/handlers/tools/github/read-tools.js +260 -0
  124. package/dist/handlers/tools/github/read-tools.js.map +1 -0
  125. package/dist/handlers/tools/github/schemas.d.ts +467 -0
  126. package/dist/handlers/tools/github/schemas.d.ts.map +1 -0
  127. package/dist/handlers/tools/github/schemas.js +335 -0
  128. package/dist/handlers/tools/github/schemas.js.map +1 -0
  129. package/dist/handlers/tools/github.d.ts +14 -0
  130. package/dist/handlers/tools/github.d.ts.map +1 -0
  131. package/dist/handlers/tools/github.js +28 -0
  132. package/dist/handlers/tools/github.js.map +1 -0
  133. package/dist/handlers/tools/index.d.ts +15 -20
  134. package/dist/handlers/tools/index.d.ts.map +1 -1
  135. package/dist/handlers/tools/index.js +117 -2909
  136. package/dist/handlers/tools/index.js.map +1 -1
  137. package/dist/handlers/tools/relationships.d.ts +8 -0
  138. package/dist/handlers/tools/relationships.d.ts.map +1 -0
  139. package/dist/handlers/tools/relationships.js +308 -0
  140. package/dist/handlers/tools/relationships.js.map +1 -0
  141. package/dist/handlers/tools/schemas.d.ts +108 -0
  142. package/dist/handlers/tools/schemas.d.ts.map +1 -0
  143. package/dist/handlers/tools/schemas.js +122 -0
  144. package/dist/handlers/tools/schemas.js.map +1 -0
  145. package/dist/handlers/tools/search.d.ts +8 -0
  146. package/dist/handlers/tools/search.d.ts.map +1 -0
  147. package/dist/handlers/tools/search.js +282 -0
  148. package/dist/handlers/tools/search.js.map +1 -0
  149. package/dist/handlers/tools/team.d.ts +11 -0
  150. package/dist/handlers/tools/team.d.ts.map +1 -0
  151. package/dist/handlers/tools/team.js +239 -0
  152. package/dist/handlers/tools/team.js.map +1 -0
  153. package/dist/server/McpServer.d.ts +4 -0
  154. package/dist/server/McpServer.d.ts.map +1 -1
  155. package/dist/server/McpServer.js +48 -297
  156. package/dist/server/McpServer.js.map +1 -1
  157. package/dist/server/Scheduler.d.ts +91 -0
  158. package/dist/server/Scheduler.d.ts.map +1 -0
  159. package/dist/server/Scheduler.js +201 -0
  160. package/dist/server/Scheduler.js.map +1 -0
  161. package/dist/transports/http.d.ts +66 -0
  162. package/dist/transports/http.d.ts.map +1 -0
  163. package/dist/transports/http.js +519 -0
  164. package/dist/transports/http.js.map +1 -0
  165. package/dist/types/entities.d.ts +101 -0
  166. package/dist/types/entities.d.ts.map +1 -0
  167. package/dist/types/entities.js +5 -0
  168. package/dist/types/entities.js.map +1 -0
  169. package/dist/types/filtering.d.ts +34 -0
  170. package/dist/types/filtering.d.ts.map +1 -0
  171. package/dist/types/filtering.js +5 -0
  172. package/dist/types/filtering.js.map +1 -0
  173. package/dist/types/github.d.ts +166 -0
  174. package/dist/types/github.d.ts.map +1 -0
  175. package/dist/types/github.js +5 -0
  176. package/dist/types/github.js.map +1 -0
  177. package/dist/types/index.d.ts +35 -292
  178. package/dist/types/index.d.ts.map +1 -1
  179. package/dist/types/index.js +2 -2
  180. package/dist/types/index.js.map +1 -1
  181. package/dist/utils/error-helpers.d.ts +37 -0
  182. package/dist/utils/error-helpers.d.ts.map +1 -0
  183. package/dist/utils/error-helpers.js +47 -0
  184. package/dist/utils/error-helpers.js.map +1 -0
  185. package/dist/utils/logger.d.ts.map +1 -1
  186. package/dist/utils/logger.js +6 -3
  187. package/dist/utils/logger.js.map +1 -1
  188. package/dist/utils/security-utils.d.ts +0 -21
  189. package/dist/utils/security-utils.d.ts.map +1 -1
  190. package/dist/utils/security-utils.js +0 -47
  191. package/dist/utils/security-utils.js.map +1 -1
  192. package/dist/vector/VectorSearchManager.d.ts.map +1 -1
  193. package/dist/vector/VectorSearchManager.js +9 -32
  194. package/dist/vector/VectorSearchManager.js.map +1 -1
  195. package/docker-compose.yml +11 -2
  196. package/hooks/README.md +107 -0
  197. package/hooks/cursor/hooks.json +10 -0
  198. package/hooks/cursor/memory-journal.mdc +22 -0
  199. package/hooks/cursor/session-end.sh +19 -0
  200. package/hooks/kilo-code/session-end-mode.json +11 -0
  201. package/hooks/kiro/session-end.md +13 -0
  202. package/mcp-config-example.json +1 -0
  203. package/package.json +11 -9
  204. package/playwright.config.ts +29 -0
  205. package/releases/v4.5.0.md +116 -0
  206. package/releases/v5.0.0.md +105 -0
  207. package/scripts/generate-server-instructions.ts +176 -0
  208. package/scripts/server-instructions-function-body.ts +77 -0
  209. package/server.json +3 -3
  210. package/src/cli.ts +45 -1
  211. package/src/constants/ServerInstructions.ts +133 -73
  212. package/src/constants/icons.ts +8 -7
  213. package/src/constants/server-instructions.md +268 -0
  214. package/src/database/SqliteAdapter.ts +358 -192
  215. package/src/database/schema.ts +125 -0
  216. package/src/filtering/ToolFilter.ts +13 -2
  217. package/src/github/GitHubIntegration.ts +1 -3
  218. package/src/handlers/prompts/github.ts +209 -0
  219. package/src/handlers/prompts/index.ts +10 -499
  220. package/src/handlers/prompts/workflow.ts +314 -0
  221. package/src/handlers/resources/core.ts +528 -0
  222. package/src/handlers/resources/github.ts +358 -0
  223. package/src/handlers/resources/graph.ts +254 -0
  224. package/src/handlers/resources/index.ts +23 -1570
  225. package/src/handlers/resources/shared.ts +103 -0
  226. package/src/handlers/resources/team.ts +133 -0
  227. package/src/handlers/resources/templates.ts +374 -0
  228. package/src/handlers/tools/admin.ts +285 -0
  229. package/src/handlers/tools/analytics.ts +301 -0
  230. package/src/handlers/tools/backup.ts +242 -0
  231. package/src/handlers/tools/core.ts +350 -0
  232. package/src/handlers/tools/export.ts +115 -0
  233. package/src/handlers/tools/github/helpers.ts +86 -0
  234. package/src/handlers/tools/github/insights-tools.ts +119 -0
  235. package/src/handlers/tools/github/issue-tools.ts +439 -0
  236. package/src/handlers/tools/github/kanban-tools.ts +134 -0
  237. package/src/handlers/tools/github/milestone-tools.ts +392 -0
  238. package/src/handlers/tools/github/mutation-tools.ts +17 -0
  239. package/src/handlers/tools/github/read-tools.ts +328 -0
  240. package/src/handlers/tools/github/schemas.ts +369 -0
  241. package/src/handlers/tools/github.ts +36 -0
  242. package/src/handlers/tools/index.ts +144 -3325
  243. package/src/handlers/tools/relationships.ts +358 -0
  244. package/src/handlers/tools/schemas.ts +132 -0
  245. package/src/handlers/tools/search.ts +343 -0
  246. package/src/handlers/tools/team.ts +273 -0
  247. package/src/server/McpServer.ts +63 -358
  248. package/src/server/Scheduler.ts +278 -0
  249. package/src/transports/http.ts +635 -0
  250. package/src/types/entities.ts +145 -0
  251. package/src/types/filtering.ts +54 -0
  252. package/src/types/github.ts +180 -0
  253. package/src/types/index.ts +67 -375
  254. package/src/utils/error-helpers.ts +52 -0
  255. package/src/utils/logger.ts +6 -3
  256. package/src/utils/security-utils.ts +0 -52
  257. package/src/vector/VectorSearchManager.ts +9 -33
  258. package/tests/constants/icons.test.ts +1 -2
  259. package/tests/constants/server-instructions.test.ts +30 -4
  260. package/tests/database/sqlite-adapter.test.ts +91 -7
  261. package/tests/e2e/auth.spec.ts +154 -0
  262. package/tests/e2e/health.spec.ts +63 -0
  263. package/tests/e2e/protocols.spec.ts +134 -0
  264. package/tests/e2e/resources.spec.ts +103 -0
  265. package/tests/e2e/scheduler.spec.ts +79 -0
  266. package/tests/e2e/security.spec.ts +91 -0
  267. package/tests/e2e/sessions.spec.ts +95 -0
  268. package/tests/e2e/stateless.spec.ts +121 -0
  269. package/tests/e2e/tools.spec.ts +111 -0
  270. package/tests/filtering/tool-filter.test.ts +46 -0
  271. package/tests/handlers/error-path-coverage.test.ts +324 -0
  272. package/tests/handlers/github-resource-handlers.test.ts +453 -0
  273. package/tests/handlers/github-tool-handlers.test.ts +899 -0
  274. package/tests/handlers/prompt-handler-coverage.test.ts +106 -0
  275. package/tests/handlers/prompt-handlers.test.ts +40 -0
  276. package/tests/handlers/resource-handler-coverage.test.ts +181 -0
  277. package/tests/handlers/resource-handlers.test.ts +33 -9
  278. package/tests/handlers/search-tool-handlers.test.ts +272 -0
  279. package/tests/handlers/targeted-gap-closure.test.ts +387 -0
  280. package/tests/handlers/team-resource-handlers.test.ts +156 -0
  281. package/tests/handlers/team-tool-handlers.test.ts +301 -0
  282. package/tests/handlers/tool-handler-coverage.test.ts +469 -0
  283. package/tests/handlers/tool-handlers.test.ts +2 -2
  284. package/tests/security/sql-injection.test.ts +3 -54
  285. package/tests/server/mcp-server.test.ts +503 -8
  286. package/tests/server/scheduler.test.ts +400 -0
  287. package/tests/transports/http-transport.test.ts +620 -0
  288. package/tests/vector/vector-search-manager.test.ts +60 -0
  289. package/vitest.config.ts +4 -1
  290. package/.memory-journal-team.db +0 -0
  291. package/.vscode/settings.json +0 -84
@@ -0,0 +1,326 @@
1
+ /**
2
+ * Core Tool Group - 6 tools
3
+ *
4
+ * Tools: create_entry, get_entry_by_id, get_recent_entries,
5
+ * create_entry_minimal, test_simple, list_tags
6
+ */
7
+ import { z } from 'zod';
8
+ import { execFileSync } from 'node:child_process';
9
+ import { formatHandlerError } from '../../utils/error-helpers.js';
10
+ import { ENTRY_TYPES, SIGNIFICANCE_TYPES, EntryOutputSchema, EntriesListOutputSchema, RelationshipOutputSchema, ImportanceBreakdownSchema, TagOutputSchema, } from './schemas.js';
11
+ // ============================================================================
12
+ // Input Schemas
13
+ // ============================================================================
14
+ /** Strict schema — used inside handler for structured Zod errors */
15
+ const CreateEntrySchema = z.object({
16
+ content: z.string().min(1).max(50000),
17
+ entry_type: z.enum(ENTRY_TYPES).optional().default('personal_reflection'),
18
+ tags: z.array(z.string()).optional().default([]),
19
+ is_personal: z.boolean().optional().default(true),
20
+ significance_type: z.enum(SIGNIFICANCE_TYPES).optional(),
21
+ auto_context: z.boolean().optional().default(true),
22
+ project_number: z.number().optional(),
23
+ project_owner: z.string().optional(),
24
+ issue_number: z.number().optional(),
25
+ issue_url: z.string().optional(),
26
+ pr_number: z.number().optional(),
27
+ pr_url: z.string().optional(),
28
+ pr_status: z.enum(['draft', 'open', 'merged', 'closed']).optional(),
29
+ workflow_run_id: z.number().optional(),
30
+ workflow_name: z.string().optional(),
31
+ workflow_status: z.enum(['queued', 'in_progress', 'completed']).optional(),
32
+ share_with_team: z.boolean().optional().default(false),
33
+ });
34
+ /** Relaxed schema — passed to SDK inputSchema so Zod enum errors reach the handler */
35
+ const CreateEntrySchemaMcp = z.object({
36
+ content: z.string().min(1).max(50000),
37
+ entry_type: z.string().optional().default('personal_reflection'),
38
+ tags: z.array(z.string()).optional().default([]),
39
+ is_personal: z.boolean().optional().default(true),
40
+ significance_type: z.string().optional(),
41
+ auto_context: z.boolean().optional().default(true),
42
+ project_number: z.number().optional(),
43
+ project_owner: z.string().optional(),
44
+ issue_number: z.number().optional(),
45
+ issue_url: z.string().optional(),
46
+ pr_number: z.number().optional(),
47
+ pr_url: z.string().optional(),
48
+ pr_status: z.string().optional(),
49
+ workflow_run_id: z.number().optional(),
50
+ workflow_name: z.string().optional(),
51
+ workflow_status: z.string().optional(),
52
+ share_with_team: z.boolean().optional().default(false),
53
+ });
54
+ const GetEntryByIdSchema = z.object({
55
+ entry_id: z.number(),
56
+ include_relationships: z.boolean().optional().default(true),
57
+ });
58
+ const GetRecentEntriesSchema = z.object({
59
+ limit: z.number().max(500).optional().default(5),
60
+ is_personal: z.boolean().optional(),
61
+ });
62
+ const CreateEntryMinimalSchema = z.object({
63
+ content: z.string().min(1).max(50000),
64
+ });
65
+ const TestSimpleSchema = z.object({
66
+ message: z.string().optional().default('Hello'),
67
+ });
68
+ // ============================================================================
69
+ // Output Schemas
70
+ // ============================================================================
71
+ const CreateEntryOutputSchema = z.object({
72
+ success: z.boolean().optional(),
73
+ entry: EntryOutputSchema.optional(),
74
+ sharedWithTeam: z.boolean().optional(),
75
+ author: z.string().optional(),
76
+ error: z.string().optional(),
77
+ });
78
+ const EntryByIdOutputSchema = z.object({
79
+ entry: EntryOutputSchema.optional(),
80
+ relationships: z.array(RelationshipOutputSchema).optional(),
81
+ importance: z.number().nullable().optional(),
82
+ importanceBreakdown: ImportanceBreakdownSchema.optional(),
83
+ error: z.string().optional(),
84
+ });
85
+ const TestSimpleOutputSchema = z.object({
86
+ message: z.string(),
87
+ });
88
+ const TagsListOutputSchema = z.object({
89
+ tags: z.array(TagOutputSchema).optional(),
90
+ count: z.number().optional(),
91
+ success: z.boolean().optional(),
92
+ error: z.string().optional(),
93
+ });
94
+ // ============================================================================
95
+ // Helpers
96
+ // ============================================================================
97
+ /** Resolve the author name for team-shared entries */
98
+ function resolveTeamAuthor() {
99
+ const envAuthor = process.env['TEAM_AUTHOR']?.trim().replace(/"/g, '');
100
+ if (envAuthor)
101
+ return envAuthor;
102
+ try {
103
+ const gitUser = execFileSync('git', ['config', 'user.name'], {
104
+ encoding: 'utf-8',
105
+ timeout: 3000,
106
+ })
107
+ .trim()
108
+ .replace(/"/g, '');
109
+ if (gitUser)
110
+ return gitUser;
111
+ }
112
+ catch {
113
+ // Git not available
114
+ }
115
+ return 'unknown';
116
+ }
117
+ // ============================================================================
118
+ // Tool Definitions
119
+ // ============================================================================
120
+ export function getCoreTools(context) {
121
+ const { db, teamDb, vectorManager, github } = context;
122
+ return [
123
+ {
124
+ name: 'create_entry',
125
+ title: 'Create Journal Entry',
126
+ description: 'Create a new journal entry with context and tags (v2.1.0: GitHub Actions support)',
127
+ group: 'core',
128
+ inputSchema: CreateEntrySchemaMcp,
129
+ outputSchema: CreateEntryOutputSchema,
130
+ annotations: { readOnlyHint: false, idempotentHint: false },
131
+ handler: (params) => {
132
+ try {
133
+ const input = CreateEntrySchema.parse(params);
134
+ // Auto-populate issueUrl if issue_number provided without issueUrl
135
+ let resolvedIssueUrl = input.issue_url;
136
+ if (input.issue_number !== undefined && !input.issue_url && github) {
137
+ const cachedRepo = github.getCachedRepoInfo();
138
+ if (cachedRepo?.owner && cachedRepo?.repo) {
139
+ resolvedIssueUrl = `https://github.com/${cachedRepo.owner}/${cachedRepo.repo}/issues/${String(input.issue_number)}`;
140
+ }
141
+ }
142
+ const entry = db.createEntry({
143
+ content: input.content,
144
+ entryType: input.entry_type,
145
+ tags: input.tags,
146
+ isPersonal: input.is_personal,
147
+ significanceType: input.significance_type ?? null,
148
+ projectNumber: input.project_number,
149
+ projectOwner: input.project_owner,
150
+ issueNumber: input.issue_number,
151
+ issueUrl: resolvedIssueUrl,
152
+ prNumber: input.pr_number,
153
+ prUrl: input.pr_url,
154
+ prStatus: input.pr_status,
155
+ workflowRunId: input.workflow_run_id,
156
+ workflowName: input.workflow_name,
157
+ workflowStatus: input.workflow_status,
158
+ });
159
+ // Auto-index to vector store for semantic search (fire-and-forget)
160
+ if (vectorManager) {
161
+ vectorManager.addEntry(entry.id, entry.content).catch(() => {
162
+ // Non-critical failure, entry already saved to DB
163
+ });
164
+ }
165
+ // Share with team if requested
166
+ let sharedWithTeam = false;
167
+ let author;
168
+ if (input.share_with_team && teamDb) {
169
+ try {
170
+ author = resolveTeamAuthor();
171
+ const teamEntry = teamDb.createEntry({
172
+ content: input.content,
173
+ entryType: input.entry_type,
174
+ tags: input.tags,
175
+ isPersonal: false,
176
+ significanceType: input.significance_type ?? null,
177
+ autoContext: JSON.stringify({ author }),
178
+ projectNumber: input.project_number,
179
+ projectOwner: input.project_owner,
180
+ issueNumber: input.issue_number,
181
+ issueUrl: resolvedIssueUrl,
182
+ prNumber: input.pr_number,
183
+ prUrl: input.pr_url,
184
+ prStatus: input.pr_status,
185
+ workflowRunId: input.workflow_run_id,
186
+ workflowName: input.workflow_name,
187
+ workflowStatus: input.workflow_status,
188
+ });
189
+ const rawTeamDb = teamDb.getRawDb();
190
+ rawTeamDb.run('UPDATE memory_journal SET author = ? WHERE id = ?', [
191
+ author,
192
+ teamEntry.id,
193
+ ]);
194
+ teamDb.flushSave();
195
+ sharedWithTeam = true;
196
+ }
197
+ catch {
198
+ // Team share failed — entry still saved to personal DB
199
+ }
200
+ }
201
+ return {
202
+ success: true,
203
+ entry,
204
+ ...(sharedWithTeam ? { sharedWithTeam: true, author } : {}),
205
+ };
206
+ }
207
+ catch (err) {
208
+ return formatHandlerError(err);
209
+ }
210
+ },
211
+ },
212
+ {
213
+ name: 'get_entry_by_id',
214
+ title: 'Get Entry by ID',
215
+ description: 'Get a specific journal entry by ID with full details',
216
+ group: 'core',
217
+ inputSchema: GetEntryByIdSchema,
218
+ outputSchema: EntryByIdOutputSchema,
219
+ annotations: { readOnlyHint: true, idempotentHint: true },
220
+ handler: (params) => {
221
+ try {
222
+ const { entry_id, include_relationships } = GetEntryByIdSchema.parse(params);
223
+ const entry = db.getEntryById(entry_id);
224
+ if (!entry) {
225
+ return { success: false, error: `Entry ${String(entry_id)} not found` };
226
+ }
227
+ const { score: importance, breakdown: importanceBreakdown } = db.calculateImportance(entry_id);
228
+ const result = {
229
+ entry,
230
+ importance,
231
+ importanceBreakdown,
232
+ };
233
+ if (include_relationships) {
234
+ result['relationships'] = db.getRelationships(entry_id);
235
+ }
236
+ return result;
237
+ }
238
+ catch (err) {
239
+ return formatHandlerError(err);
240
+ }
241
+ },
242
+ },
243
+ {
244
+ name: 'get_recent_entries',
245
+ title: 'Get Recent Entries',
246
+ description: 'Get recent journal entries',
247
+ group: 'core',
248
+ inputSchema: GetRecentEntriesSchema,
249
+ outputSchema: EntriesListOutputSchema,
250
+ annotations: { readOnlyHint: true, idempotentHint: true },
251
+ handler: (params) => {
252
+ try {
253
+ const { limit, is_personal } = GetRecentEntriesSchema.parse(params);
254
+ const entries = db.getRecentEntries(limit, is_personal);
255
+ return { entries, count: entries.length };
256
+ }
257
+ catch (err) {
258
+ return formatHandlerError(err);
259
+ }
260
+ },
261
+ },
262
+ {
263
+ name: 'create_entry_minimal',
264
+ title: 'Create Entry (Minimal)',
265
+ description: 'Minimal entry creation without context or tags',
266
+ group: 'core',
267
+ inputSchema: CreateEntryMinimalSchema,
268
+ outputSchema: CreateEntryOutputSchema,
269
+ annotations: { readOnlyHint: false, idempotentHint: false },
270
+ handler: (params) => {
271
+ try {
272
+ const { content } = CreateEntryMinimalSchema.parse(params);
273
+ const entry = db.createEntry({ content });
274
+ // Auto-index to vector store for semantic search (fire-and-forget)
275
+ if (vectorManager) {
276
+ vectorManager.addEntry(entry.id, entry.content).catch(() => {
277
+ // Non-critical failure, entry already saved to DB
278
+ });
279
+ }
280
+ return { success: true, entry };
281
+ }
282
+ catch (err) {
283
+ return formatHandlerError(err);
284
+ }
285
+ },
286
+ },
287
+ {
288
+ name: 'test_simple',
289
+ title: 'Test Simple',
290
+ description: 'Simple test tool that just returns a message',
291
+ group: 'core',
292
+ inputSchema: TestSimpleSchema,
293
+ outputSchema: TestSimpleOutputSchema,
294
+ annotations: { readOnlyHint: true, idempotentHint: true },
295
+ handler: (params) => {
296
+ try {
297
+ const { message } = TestSimpleSchema.parse(params);
298
+ return { message: `Test response: ${message}` };
299
+ }
300
+ catch (err) {
301
+ return formatHandlerError(err);
302
+ }
303
+ },
304
+ },
305
+ {
306
+ name: 'list_tags',
307
+ title: 'List Tags',
308
+ description: 'List all available tags',
309
+ group: 'core',
310
+ inputSchema: z.object({}),
311
+ outputSchema: TagsListOutputSchema,
312
+ annotations: { readOnlyHint: true, idempotentHint: true },
313
+ handler: (_params) => {
314
+ try {
315
+ const rawTags = db.listTags();
316
+ const tags = rawTags.map((t) => ({ name: t.name, count: t.usageCount }));
317
+ return { tags, count: tags.length };
318
+ }
319
+ catch (err) {
320
+ return formatHandlerError(err);
321
+ }
322
+ },
323
+ },
324
+ ];
325
+ }
326
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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C,CAAA;gBAClC,CAAC;YACL,CAAC;SACJ;QACD;YACI,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,yBAAyB;YACtC,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YACzB,YAAY,EAAE,oBAAoB;YAClC,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;YACzD,OAAO,EAAE,CAAC,OAAgB,EAAE,EAAE;gBAC1B,IAAI,CAAC;oBACD,MAAM,OAAO,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAA;oBAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAA;oBACxE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAA;gBACvC,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACX,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAA;gBAClC,CAAC;YACL,CAAC;SACJ;KACJ,CAAA;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Export Tool Group - 1 tool
3
+ *
4
+ * Tools: export_entries
5
+ */
6
+ import type { ToolDefinition, ToolContext } from '../../types/index.js';
7
+ export declare function getExportTools(context: ToolContext): ToolDefinition[];
8
+ //# sourceMappingURL=export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../src/handlers/tools/export.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AA4DvE,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,EAAE,CA+CrE"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Export Tool Group - 1 tool
3
+ *
4
+ * Tools: export_entries
5
+ */
6
+ import { z } from 'zod';
7
+ import { formatHandlerError } from '../../utils/error-helpers.js';
8
+ import { sendProgress } from '../../utils/progress-utils.js';
9
+ import { ENTRY_TYPES, DATE_FORMAT_REGEX, DATE_FORMAT_MESSAGE, EntryOutputSchema, } from './schemas.js';
10
+ // ============================================================================
11
+ // Input Schemas
12
+ // ============================================================================
13
+ /** Strict schema — used inside handler for structured Zod errors */
14
+ const ExportEntriesSchema = z.object({
15
+ format: z.enum(['json', 'markdown']).optional().default('json'),
16
+ start_date: z.string().regex(DATE_FORMAT_REGEX, DATE_FORMAT_MESSAGE).optional(),
17
+ end_date: z.string().regex(DATE_FORMAT_REGEX, DATE_FORMAT_MESSAGE).optional(),
18
+ entry_types: z.array(z.enum(ENTRY_TYPES)).optional(),
19
+ tags: z.array(z.string()).optional(),
20
+ limit: z
21
+ .number()
22
+ .max(500)
23
+ .optional()
24
+ .default(100)
25
+ .describe('Maximum entries to export (default: 100)'),
26
+ });
27
+ /** Relaxed schema — passed to SDK inputSchema so Zod errors reach the handler */
28
+ const ExportEntriesSchemaMcp = z.object({
29
+ format: z.string().optional().default('json'),
30
+ start_date: z.string().optional(),
31
+ end_date: z.string().optional(),
32
+ entry_types: z.array(z.string()).optional(),
33
+ tags: z.array(z.string()).optional(),
34
+ limit: z
35
+ .number()
36
+ .max(500)
37
+ .optional()
38
+ .default(100)
39
+ .describe('Maximum entries to export (default: 100)'),
40
+ });
41
+ // ============================================================================
42
+ // Output Schemas
43
+ // ============================================================================
44
+ const ExportEntriesOutputSchema = z.object({
45
+ format: z.enum(['json', 'markdown']).optional(),
46
+ entries: z.array(EntryOutputSchema).optional(),
47
+ content: z.string().optional(),
48
+ success: z.boolean().optional(),
49
+ error: z.string().optional(),
50
+ });
51
+ // ============================================================================
52
+ // Tool Definitions
53
+ // ============================================================================
54
+ export function getExportTools(context) {
55
+ const { db, progress } = context;
56
+ return [
57
+ {
58
+ name: 'export_entries',
59
+ title: 'Export Entries',
60
+ description: 'Export journal entries to JSON or Markdown format',
61
+ group: 'export',
62
+ inputSchema: ExportEntriesSchemaMcp,
63
+ outputSchema: ExportEntriesOutputSchema,
64
+ annotations: { readOnlyHint: true, idempotentHint: true },
65
+ handler: async (params) => {
66
+ try {
67
+ const input = ExportEntriesSchema.parse(params);
68
+ const limit = input.limit ?? 100;
69
+ await sendProgress(progress, 0, 2, 'Fetching entries...');
70
+ const entries = db.getRecentEntries(limit);
71
+ await sendProgress(progress, 1, 2, `Processing ${String(entries.length)} entries...`);
72
+ if (input.format === 'markdown') {
73
+ const md = entries
74
+ .map((e) => `## ${e.timestamp}\n\n**Type:** ${e.entryType}\n\n${e.content}\n\n---`)
75
+ .join('\n\n');
76
+ await sendProgress(progress, 2, 2, 'Export complete');
77
+ return { format: 'markdown', content: md };
78
+ }
79
+ await sendProgress(progress, 2, 2, 'Export complete');
80
+ return { format: 'json', entries };
81
+ }
82
+ catch (err) {
83
+ return formatHandlerError(err);
84
+ }
85
+ },
86
+ },
87
+ ];
88
+ }
89
+ //# sourceMappingURL=export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export.js","sourceRoot":"","sources":["../../../src/handlers/tools/export.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EACH,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GACpB,MAAM,cAAc,CAAA;AAErB,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,oEAAoE;AACpE,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,CAAC,CAAC,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,CAAA;oBAEzD,MAAM,OAAO,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;oBAE1C,MAAM,YAAY,CACd,QAAQ,EACR,CAAC,EACD,CAAC,EACD,cAAc,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CACpD,CAAA;oBAED,IAAI,KAAK,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;wBAC9B,MAAM,EAAE,GAAG,OAAO;6BACb,GAAG,CACA,CAAC,CAAC,EAAE,EAAE,CACF,MAAM,CAAC,CAAC,SAAS,iBAAiB,CAAC,CAAC,SAAS,OAAO,CAAC,CAAC,OAAO,SAAS,CAC7E;6BACA,IAAI,CAAC,MAAM,CAAC,CAAA;wBAEjB,MAAM,YAAY,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,iBAAiB,CAAC,CAAA;wBACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;oBAC9C,CAAC;oBAED,MAAM,YAAY,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,iBAAiB,CAAC,CAAA;oBACrD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;gBACtC,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACX,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAA;gBAClC,CAAC;YACL,CAAC;SACJ;KACJ,CAAA;AACL,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * GitHub Tool Helpers - Shared owner/repo resolution
3
+ */
4
+ import type { ToolContext } from '../../../types/index.js';
5
+ import type { GitHubIntegration } from '../../../github/GitHubIntegration.js';
6
+ /**
7
+ * Resolve owner (owner-only, no repo required)
8
+ */
9
+ export declare function resolveOwner(context: ToolContext, inputOwner?: string): Promise<{
10
+ owner: string;
11
+ detectedOwner: string | null;
12
+ repo: string | undefined;
13
+ github: GitHubIntegration;
14
+ } | {
15
+ error: true;
16
+ response: Record<string, unknown>;
17
+ }>;
18
+ /**
19
+ * Resolve owner + repo (both required)
20
+ */
21
+ export declare function resolveOwnerRepo(context: ToolContext, input: {
22
+ owner?: string;
23
+ repo?: string;
24
+ }): Promise<{
25
+ owner: string;
26
+ repo: string;
27
+ detectedOwner: string | null;
28
+ detectedRepo: string | null;
29
+ github: GitHubIntegration;
30
+ } | {
31
+ error: true;
32
+ response: Record<string, unknown>;
33
+ }>;
34
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/handlers/tools/github/helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAA;AAE7E;;GAEG;AACH,wBAAsB,YAAY,CAC9B,OAAO,EAAE,WAAW,EACpB,UAAU,CAAC,EAAE,MAAM,GACpB,OAAO,CACJ;IACI,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,MAAM,EAAE,iBAAiB,CAAA;CAC5B,GACD;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CACvD,CAwBA;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAClC,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC,OAAO,CACJ;IACI,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,MAAM,EAAE,iBAAiB,CAAA;CAC5B,GACD;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CACvD,CAuBA"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * GitHub Tool Helpers - Shared owner/repo resolution
3
+ */
4
+ /**
5
+ * Resolve owner (owner-only, no repo required)
6
+ */
7
+ export async function resolveOwner(context, inputOwner) {
8
+ if (!context.github) {
9
+ return { error: true, response: { error: 'GitHub integration not available' } };
10
+ }
11
+ const repoInfo = await context.github.getRepoInfo();
12
+ const detectedOwner = repoInfo.owner;
13
+ const owner = inputOwner ?? detectedOwner ?? undefined;
14
+ const repo = repoInfo.repo ?? undefined;
15
+ if (!owner) {
16
+ return {
17
+ error: true,
18
+ response: {
19
+ error: 'STOP: Could not auto-detect repository owner. DO NOT GUESS. You MUST ask the user to provide the GitHub owner.',
20
+ requiresUserInput: true,
21
+ detectedOwner,
22
+ instruction: 'Ask the user: "What GitHub username or organization owns this project?"',
23
+ },
24
+ };
25
+ }
26
+ return { owner, detectedOwner, repo, github: context.github };
27
+ }
28
+ /**
29
+ * Resolve owner + repo (both required)
30
+ */
31
+ export async function resolveOwnerRepo(context, input) {
32
+ if (!context.github) {
33
+ return { error: true, response: { error: 'GitHub integration not available' } };
34
+ }
35
+ const repoInfo = await context.github.getRepoInfo();
36
+ const detectedOwner = repoInfo.owner;
37
+ const detectedRepo = repoInfo.repo;
38
+ const owner = input.owner ?? detectedOwner ?? undefined;
39
+ const repo = input.repo ?? detectedRepo ?? undefined;
40
+ if (!owner || !repo) {
41
+ return {
42
+ error: true,
43
+ response: {
44
+ error: 'STOP: Could not auto-detect repository. DO NOT GUESS.',
45
+ requiresUserInput: true,
46
+ detected: { owner, repo },
47
+ },
48
+ };
49
+ }
50
+ return { owner, repo, detectedOwner, detectedRepo, github: context.github };
51
+ }
52
+ //# sourceMappingURL=helpers.js.map
@@ -0,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G,QAAQ,CAAC,KAAK,CAAA;IACpC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAA;IAClC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,aAAa,IAAI,SAAS,CAAA;IACvD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,YAAY,IAAI,SAAS,CAAA;IAEpD,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO;YACH,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE;gBACN,KAAK,EAAE,uDAAuD;gBAC9D,iBAAiB,EAAE,IAAI;gBACvB,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;aAC5B;SACJ,CAAA;IACL,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;AAC/E,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * GitHub Insights Tools - 1 tool
3
+ *
4
+ * Tools: get_repo_insights
5
+ */
6
+ import type { ToolDefinition, ToolContext } from '../../../types/index.js';
7
+ export declare function getGitHubInsightsTools(context: ToolContext): ToolDefinition[];
8
+ //# sourceMappingURL=insights-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insights-tools.d.ts","sourceRoot":"","sources":["../../../../src/handlers/tools/github/insights-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAQ1E,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,EAAE,CAuG7E"}