memory-journal-mcp 4.4.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/codeql.yml +1 -6
- package/.github/workflows/docker-publish.yml +15 -49
- package/.github/workflows/lint-and-test.yml +1 -1
- package/.github/workflows/secrets-scanning.yml +4 -3
- package/.github/workflows/security-update.yml +3 -3
- package/CHANGELOG.md +213 -0
- package/CONTRIBUTING.md +132 -97
- package/DOCKER_README.md +184 -235
- package/Dockerfile +27 -24
- package/README.md +218 -190
- package/SECURITY.md +27 -35
- package/dist/cli.js +16 -1
- package/dist/cli.js.map +1 -1
- package/dist/constants/ServerInstructions.d.ts +5 -1
- package/dist/constants/ServerInstructions.d.ts.map +1 -1
- package/dist/constants/ServerInstructions.js +133 -73
- package/dist/constants/ServerInstructions.js.map +1 -1
- package/dist/constants/icons.d.ts +2 -2
- package/dist/constants/icons.d.ts.map +1 -1
- package/dist/constants/icons.js +7 -6
- package/dist/constants/icons.js.map +1 -1
- package/dist/database/SqliteAdapter.d.ts +37 -24
- package/dist/database/SqliteAdapter.d.ts.map +1 -1
- package/dist/database/SqliteAdapter.js +319 -157
- package/dist/database/SqliteAdapter.js.map +1 -1
- package/dist/database/schema.d.ts +45 -0
- package/dist/database/schema.d.ts.map +1 -0
- package/dist/database/schema.js +92 -0
- package/dist/database/schema.js.map +1 -0
- package/dist/filtering/ToolFilter.d.ts +1 -1
- package/dist/filtering/ToolFilter.d.ts.map +1 -1
- package/dist/filtering/ToolFilter.js +13 -2
- package/dist/filtering/ToolFilter.js.map +1 -1
- package/dist/github/GitHubIntegration.d.ts.map +1 -1
- package/dist/github/GitHubIntegration.js +1 -3
- package/dist/github/GitHubIntegration.js.map +1 -1
- package/dist/handlers/prompts/github.d.ts +12 -0
- package/dist/handlers/prompts/github.d.ts.map +1 -0
- package/dist/handlers/prompts/github.js +178 -0
- package/dist/handlers/prompts/github.js.map +1 -0
- package/dist/handlers/prompts/index.d.ts +23 -2
- package/dist/handlers/prompts/index.d.ts.map +1 -1
- package/dist/handlers/prompts/index.js +7 -432
- package/dist/handlers/prompts/index.js.map +1 -1
- package/dist/handlers/prompts/workflow.d.ts +12 -0
- package/dist/handlers/prompts/workflow.d.ts.map +1 -0
- package/dist/handlers/prompts/workflow.js +277 -0
- package/dist/handlers/prompts/workflow.js.map +1 -0
- package/dist/handlers/resources/core.d.ts +11 -0
- package/dist/handlers/resources/core.d.ts.map +1 -0
- package/dist/handlers/resources/core.js +433 -0
- package/dist/handlers/resources/core.js.map +1 -0
- package/dist/handlers/resources/github.d.ts +11 -0
- package/dist/handlers/resources/github.d.ts.map +1 -0
- package/dist/handlers/resources/github.js +314 -0
- package/dist/handlers/resources/github.js.map +1 -0
- package/dist/handlers/resources/graph.d.ts +11 -0
- package/dist/handlers/resources/graph.d.ts.map +1 -0
- package/dist/handlers/resources/graph.js +204 -0
- package/dist/handlers/resources/graph.js.map +1 -0
- package/dist/handlers/resources/index.d.ts +5 -20
- package/dist/handlers/resources/index.d.ts.map +1 -1
- package/dist/handlers/resources/index.js +16 -1278
- package/dist/handlers/resources/index.js.map +1 -1
- package/dist/handlers/resources/shared.d.ts +60 -0
- package/dist/handlers/resources/shared.d.ts.map +1 -0
- package/dist/handlers/resources/shared.js +49 -0
- package/dist/handlers/resources/shared.js.map +1 -0
- package/dist/handlers/resources/team.d.ts +13 -0
- package/dist/handlers/resources/team.d.ts.map +1 -0
- package/dist/handlers/resources/team.js +119 -0
- package/dist/handlers/resources/team.js.map +1 -0
- package/dist/handlers/resources/templates.d.ts +13 -0
- package/dist/handlers/resources/templates.d.ts.map +1 -0
- package/dist/handlers/resources/templates.js +310 -0
- package/dist/handlers/resources/templates.js.map +1 -0
- package/dist/handlers/tools/admin.d.ts +8 -0
- package/dist/handlers/tools/admin.d.ts.map +1 -0
- package/dist/handlers/tools/admin.js +270 -0
- package/dist/handlers/tools/admin.js.map +1 -0
- package/dist/handlers/tools/analytics.d.ts +8 -0
- package/dist/handlers/tools/analytics.d.ts.map +1 -0
- package/dist/handlers/tools/analytics.js +256 -0
- package/dist/handlers/tools/analytics.js.map +1 -0
- package/dist/handlers/tools/backup.d.ts +8 -0
- package/dist/handlers/tools/backup.d.ts.map +1 -0
- package/dist/handlers/tools/backup.js +224 -0
- package/dist/handlers/tools/backup.js.map +1 -0
- package/dist/handlers/tools/core.d.ts +9 -0
- package/dist/handlers/tools/core.d.ts.map +1 -0
- package/dist/handlers/tools/core.js +326 -0
- package/dist/handlers/tools/core.js.map +1 -0
- package/dist/handlers/tools/export.d.ts +8 -0
- package/dist/handlers/tools/export.d.ts.map +1 -0
- package/dist/handlers/tools/export.js +89 -0
- package/dist/handlers/tools/export.js.map +1 -0
- package/dist/handlers/tools/github/helpers.d.ts +34 -0
- package/dist/handlers/tools/github/helpers.d.ts.map +1 -0
- package/dist/handlers/tools/github/helpers.js +52 -0
- package/dist/handlers/tools/github/helpers.js.map +1 -0
- package/dist/handlers/tools/github/insights-tools.d.ts +8 -0
- package/dist/handlers/tools/github/insights-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/insights-tools.js +104 -0
- package/dist/handlers/tools/github/insights-tools.js.map +1 -0
- package/dist/handlers/tools/github/issue-tools.d.ts +8 -0
- package/dist/handlers/tools/github/issue-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/issue-tools.js +359 -0
- package/dist/handlers/tools/github/issue-tools.js.map +1 -0
- package/dist/handlers/tools/github/kanban-tools.d.ts +8 -0
- package/dist/handlers/tools/github/kanban-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/kanban-tools.js +108 -0
- package/dist/handlers/tools/github/kanban-tools.js.map +1 -0
- package/dist/handlers/tools/github/milestone-tools.d.ts +9 -0
- package/dist/handlers/tools/github/milestone-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/milestone-tools.js +302 -0
- package/dist/handlers/tools/github/milestone-tools.js.map +1 -0
- package/dist/handlers/tools/github/mutation-tools.d.ts +12 -0
- package/dist/handlers/tools/github/mutation-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/mutation-tools.js +15 -0
- package/dist/handlers/tools/github/mutation-tools.js.map +1 -0
- package/dist/handlers/tools/github/read-tools.d.ts +8 -0
- package/dist/handlers/tools/github/read-tools.d.ts.map +1 -0
- package/dist/handlers/tools/github/read-tools.js +260 -0
- package/dist/handlers/tools/github/read-tools.js.map +1 -0
- package/dist/handlers/tools/github/schemas.d.ts +467 -0
- package/dist/handlers/tools/github/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/github/schemas.js +335 -0
- package/dist/handlers/tools/github/schemas.js.map +1 -0
- package/dist/handlers/tools/github.d.ts +14 -0
- package/dist/handlers/tools/github.d.ts.map +1 -0
- package/dist/handlers/tools/github.js +28 -0
- package/dist/handlers/tools/github.js.map +1 -0
- package/dist/handlers/tools/index.d.ts +15 -20
- package/dist/handlers/tools/index.d.ts.map +1 -1
- package/dist/handlers/tools/index.js +117 -2909
- package/dist/handlers/tools/index.js.map +1 -1
- package/dist/handlers/tools/relationships.d.ts +8 -0
- package/dist/handlers/tools/relationships.d.ts.map +1 -0
- package/dist/handlers/tools/relationships.js +308 -0
- package/dist/handlers/tools/relationships.js.map +1 -0
- package/dist/handlers/tools/schemas.d.ts +108 -0
- package/dist/handlers/tools/schemas.d.ts.map +1 -0
- package/dist/handlers/tools/schemas.js +122 -0
- package/dist/handlers/tools/schemas.js.map +1 -0
- package/dist/handlers/tools/search.d.ts +8 -0
- package/dist/handlers/tools/search.d.ts.map +1 -0
- package/dist/handlers/tools/search.js +282 -0
- package/dist/handlers/tools/search.js.map +1 -0
- package/dist/handlers/tools/team.d.ts +11 -0
- package/dist/handlers/tools/team.d.ts.map +1 -0
- package/dist/handlers/tools/team.js +239 -0
- package/dist/handlers/tools/team.js.map +1 -0
- package/dist/server/McpServer.d.ts +4 -0
- package/dist/server/McpServer.d.ts.map +1 -1
- package/dist/server/McpServer.js +48 -297
- package/dist/server/McpServer.js.map +1 -1
- package/dist/server/Scheduler.d.ts +91 -0
- package/dist/server/Scheduler.d.ts.map +1 -0
- package/dist/server/Scheduler.js +201 -0
- package/dist/server/Scheduler.js.map +1 -0
- package/dist/transports/http.d.ts +66 -0
- package/dist/transports/http.d.ts.map +1 -0
- package/dist/transports/http.js +519 -0
- package/dist/transports/http.js.map +1 -0
- package/dist/types/entities.d.ts +101 -0
- package/dist/types/entities.d.ts.map +1 -0
- package/dist/types/entities.js +5 -0
- package/dist/types/entities.js.map +1 -0
- package/dist/types/filtering.d.ts +34 -0
- package/dist/types/filtering.d.ts.map +1 -0
- package/dist/types/filtering.js +5 -0
- package/dist/types/filtering.js.map +1 -0
- package/dist/types/github.d.ts +166 -0
- package/dist/types/github.d.ts.map +1 -0
- package/dist/types/github.js +5 -0
- package/dist/types/github.js.map +1 -0
- package/dist/types/index.d.ts +35 -292
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.js.map +1 -1
- package/dist/utils/error-helpers.d.ts +37 -0
- package/dist/utils/error-helpers.d.ts.map +1 -0
- package/dist/utils/error-helpers.js +47 -0
- package/dist/utils/error-helpers.js.map +1 -0
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +6 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/security-utils.d.ts +0 -21
- package/dist/utils/security-utils.d.ts.map +1 -1
- package/dist/utils/security-utils.js +0 -47
- package/dist/utils/security-utils.js.map +1 -1
- package/dist/vector/VectorSearchManager.d.ts.map +1 -1
- package/dist/vector/VectorSearchManager.js +9 -32
- package/dist/vector/VectorSearchManager.js.map +1 -1
- package/docker-compose.yml +11 -2
- package/hooks/README.md +107 -0
- package/hooks/cursor/hooks.json +10 -0
- package/hooks/cursor/memory-journal.mdc +22 -0
- package/hooks/cursor/session-end.sh +19 -0
- package/hooks/kilo-code/session-end-mode.json +11 -0
- package/hooks/kiro/session-end.md +13 -0
- package/mcp-config-example.json +1 -0
- package/package.json +11 -9
- package/playwright.config.ts +29 -0
- package/releases/v4.5.0.md +116 -0
- package/releases/v5.0.0.md +105 -0
- package/scripts/generate-server-instructions.ts +176 -0
- package/scripts/server-instructions-function-body.ts +77 -0
- package/server.json +3 -3
- package/src/cli.ts +45 -1
- package/src/constants/ServerInstructions.ts +133 -73
- package/src/constants/icons.ts +8 -7
- package/src/constants/server-instructions.md +268 -0
- package/src/database/SqliteAdapter.ts +358 -192
- package/src/database/schema.ts +125 -0
- package/src/filtering/ToolFilter.ts +13 -2
- package/src/github/GitHubIntegration.ts +1 -3
- package/src/handlers/prompts/github.ts +209 -0
- package/src/handlers/prompts/index.ts +10 -499
- package/src/handlers/prompts/workflow.ts +314 -0
- package/src/handlers/resources/core.ts +528 -0
- package/src/handlers/resources/github.ts +358 -0
- package/src/handlers/resources/graph.ts +254 -0
- package/src/handlers/resources/index.ts +23 -1570
- package/src/handlers/resources/shared.ts +103 -0
- package/src/handlers/resources/team.ts +133 -0
- package/src/handlers/resources/templates.ts +374 -0
- package/src/handlers/tools/admin.ts +285 -0
- package/src/handlers/tools/analytics.ts +301 -0
- package/src/handlers/tools/backup.ts +242 -0
- package/src/handlers/tools/core.ts +350 -0
- package/src/handlers/tools/export.ts +115 -0
- package/src/handlers/tools/github/helpers.ts +86 -0
- package/src/handlers/tools/github/insights-tools.ts +119 -0
- package/src/handlers/tools/github/issue-tools.ts +439 -0
- package/src/handlers/tools/github/kanban-tools.ts +134 -0
- package/src/handlers/tools/github/milestone-tools.ts +392 -0
- package/src/handlers/tools/github/mutation-tools.ts +17 -0
- package/src/handlers/tools/github/read-tools.ts +328 -0
- package/src/handlers/tools/github/schemas.ts +369 -0
- package/src/handlers/tools/github.ts +36 -0
- package/src/handlers/tools/index.ts +144 -3325
- package/src/handlers/tools/relationships.ts +358 -0
- package/src/handlers/tools/schemas.ts +132 -0
- package/src/handlers/tools/search.ts +343 -0
- package/src/handlers/tools/team.ts +273 -0
- package/src/server/McpServer.ts +63 -358
- package/src/server/Scheduler.ts +278 -0
- package/src/transports/http.ts +635 -0
- package/src/types/entities.ts +145 -0
- package/src/types/filtering.ts +54 -0
- package/src/types/github.ts +180 -0
- package/src/types/index.ts +67 -375
- package/src/utils/error-helpers.ts +52 -0
- package/src/utils/logger.ts +6 -3
- package/src/utils/security-utils.ts +0 -52
- package/src/vector/VectorSearchManager.ts +9 -33
- package/tests/constants/icons.test.ts +1 -2
- package/tests/constants/server-instructions.test.ts +30 -4
- package/tests/database/sqlite-adapter.test.ts +91 -7
- package/tests/e2e/auth.spec.ts +154 -0
- package/tests/e2e/health.spec.ts +63 -0
- package/tests/e2e/protocols.spec.ts +134 -0
- package/tests/e2e/resources.spec.ts +103 -0
- package/tests/e2e/scheduler.spec.ts +79 -0
- package/tests/e2e/security.spec.ts +91 -0
- package/tests/e2e/sessions.spec.ts +95 -0
- package/tests/e2e/stateless.spec.ts +121 -0
- package/tests/e2e/tools.spec.ts +111 -0
- package/tests/filtering/tool-filter.test.ts +46 -0
- package/tests/handlers/error-path-coverage.test.ts +324 -0
- package/tests/handlers/github-resource-handlers.test.ts +453 -0
- package/tests/handlers/github-tool-handlers.test.ts +899 -0
- package/tests/handlers/prompt-handler-coverage.test.ts +106 -0
- package/tests/handlers/prompt-handlers.test.ts +40 -0
- package/tests/handlers/resource-handler-coverage.test.ts +181 -0
- package/tests/handlers/resource-handlers.test.ts +33 -9
- package/tests/handlers/search-tool-handlers.test.ts +272 -0
- package/tests/handlers/targeted-gap-closure.test.ts +387 -0
- package/tests/handlers/team-resource-handlers.test.ts +156 -0
- package/tests/handlers/team-tool-handlers.test.ts +301 -0
- package/tests/handlers/tool-handler-coverage.test.ts +469 -0
- package/tests/handlers/tool-handlers.test.ts +2 -2
- package/tests/security/sql-injection.test.ts +3 -54
- package/tests/server/mcp-server.test.ts +503 -8
- package/tests/server/scheduler.test.ts +400 -0
- package/tests/transports/http-transport.test.ts +620 -0
- package/tests/vector/vector-search-manager.test.ts +60 -0
- package/vitest.config.ts +4 -1
- package/.memory-journal-team.db +0 -0
- package/.vscode/settings.json +0 -84
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Memory Journal MCP Server - Prompt Handlers
|
|
3
3
|
*
|
|
4
|
+
* Barrel file composing prompt definitions from sub-modules.
|
|
4
5
|
* Exports all MCP prompts for workflow guidance.
|
|
5
6
|
*/
|
|
6
7
|
|
|
7
8
|
import type { SqliteAdapter } from '../../database/SqliteAdapter.js'
|
|
8
9
|
import type { McpIcon } from '../../types/index.js'
|
|
9
|
-
import {
|
|
10
|
+
import { getWorkflowPromptDefinitions } from './workflow.js'
|
|
11
|
+
import { getGitHubPromptDefinitions } from './github.js'
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Message format for MCP prompts
|
|
13
15
|
*/
|
|
14
|
-
interface PromptMessage {
|
|
16
|
+
export interface PromptMessage {
|
|
15
17
|
role: string
|
|
16
18
|
content: {
|
|
17
19
|
type: string
|
|
@@ -22,7 +24,7 @@ interface PromptMessage {
|
|
|
22
24
|
/**
|
|
23
25
|
* Internal prompt definition with db handler
|
|
24
26
|
*/
|
|
25
|
-
interface InternalPromptDef {
|
|
27
|
+
export interface InternalPromptDef {
|
|
26
28
|
name: string
|
|
27
29
|
description: string
|
|
28
30
|
arguments?: {
|
|
@@ -30,14 +32,14 @@ interface InternalPromptDef {
|
|
|
30
32
|
description: string
|
|
31
33
|
required?: boolean
|
|
32
34
|
}[]
|
|
33
|
-
icons?: McpIcon[]
|
|
35
|
+
icons?: McpIcon[]
|
|
34
36
|
handler: (args: Record<string, string>, db: SqliteAdapter) => { messages: PromptMessage[] }
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
40
|
* Execute a raw SQL query on the database
|
|
39
41
|
*/
|
|
40
|
-
function execQuery(
|
|
42
|
+
export function execQuery(
|
|
41
43
|
db: SqliteAdapter,
|
|
42
44
|
sql: string,
|
|
43
45
|
params: unknown[] = []
|
|
@@ -65,7 +67,7 @@ export function getPrompts(): object[] {
|
|
|
65
67
|
name: p.name,
|
|
66
68
|
description: p.description,
|
|
67
69
|
arguments: p.arguments,
|
|
68
|
-
icons: p.icons,
|
|
70
|
+
icons: p.icons,
|
|
69
71
|
}))
|
|
70
72
|
}
|
|
71
73
|
|
|
@@ -88,499 +90,8 @@ export function getPrompt(
|
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
/**
|
|
91
|
-
* Get all prompt definitions
|
|
93
|
+
* Get all prompt definitions by composing sub-module definitions
|
|
92
94
|
*/
|
|
93
95
|
function getAllPromptDefinitions(): InternalPromptDef[] {
|
|
94
|
-
return [
|
|
95
|
-
{
|
|
96
|
-
name: 'find-related',
|
|
97
|
-
description: 'Discover connected entries via semantic similarity',
|
|
98
|
-
icons: [ICON_PROMPT],
|
|
99
|
-
arguments: [
|
|
100
|
-
{
|
|
101
|
-
name: 'query',
|
|
102
|
-
description: 'Search query for finding related entries',
|
|
103
|
-
required: true,
|
|
104
|
-
},
|
|
105
|
-
],
|
|
106
|
-
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
107
|
-
const query = args['query'] ?? ''
|
|
108
|
-
const entries = db.searchEntries(query, { limit: 5 })
|
|
109
|
-
|
|
110
|
-
return {
|
|
111
|
-
messages: [
|
|
112
|
-
{
|
|
113
|
-
role: 'user',
|
|
114
|
-
content: {
|
|
115
|
-
type: 'text',
|
|
116
|
-
text: `Find entries related to: "${query}"\n\nRecent matching entries:\n${entries.map((e) => `- [${String(e.id)}] ${e.content.slice(0, 100)}...`).join('\n')}`,
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
name: 'prepare-standup',
|
|
125
|
-
description: 'Daily standup summaries',
|
|
126
|
-
icons: [ICON_PROMPT],
|
|
127
|
-
arguments: [],
|
|
128
|
-
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
129
|
-
const today = new Date().toISOString().split('T')[0] ?? ''
|
|
130
|
-
const yesterday = new Date(Date.now() - 86400000).toISOString().split('T')[0] ?? ''
|
|
131
|
-
|
|
132
|
-
const entries = db.searchByDateRange(yesterday, today)
|
|
133
|
-
|
|
134
|
-
return {
|
|
135
|
-
messages: [
|
|
136
|
-
{
|
|
137
|
-
role: 'user',
|
|
138
|
-
content: {
|
|
139
|
-
type: 'text',
|
|
140
|
-
text: `Prepare a standup summary based on these recent entries:\n\n${entries.map((e) => `[${e.timestamp}] ${e.entryType}: ${e.content}`).join('\n\n')}\n\nFormat as:\n- Yesterday: <summary>\n- Today: <planned work>\n- Blockers: <any blockers>`,
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: 'prepare-retro',
|
|
149
|
-
description: 'Sprint retrospectives',
|
|
150
|
-
icons: [ICON_PROMPT],
|
|
151
|
-
arguments: [
|
|
152
|
-
{
|
|
153
|
-
name: 'days',
|
|
154
|
-
description: 'Number of days to include (default: 14)',
|
|
155
|
-
required: false,
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
159
|
-
const days = parseInt(args['days'] ?? '14', 10)
|
|
160
|
-
const endDate = new Date().toISOString().split('T')[0] ?? ''
|
|
161
|
-
const startDate =
|
|
162
|
-
new Date(Date.now() - days * 86400000).toISOString().split('T')[0] ?? ''
|
|
163
|
-
|
|
164
|
-
const entries = db.searchByDateRange(startDate, endDate)
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
messages: [
|
|
168
|
-
{
|
|
169
|
-
role: 'user',
|
|
170
|
-
content: {
|
|
171
|
-
type: 'text',
|
|
172
|
-
text: `Prepare a retrospective for the last ${String(days)} days based on these entries:\n\n${entries
|
|
173
|
-
.slice(0, 20)
|
|
174
|
-
.map(
|
|
175
|
-
(e) =>
|
|
176
|
-
`[${e.timestamp}] ${e.entryType}: ${e.content.slice(0, 200)}`
|
|
177
|
-
)
|
|
178
|
-
.join(
|
|
179
|
-
'\n\n'
|
|
180
|
-
)}\n\nFormat as:\n- What went well\n- What could improve\n- Action items`,
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
name: 'weekly-digest',
|
|
189
|
-
description: 'Day-by-day weekly summaries',
|
|
190
|
-
icons: [ICON_PROMPT],
|
|
191
|
-
arguments: [],
|
|
192
|
-
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
193
|
-
const endDate = new Date().toISOString().split('T')[0] ?? ''
|
|
194
|
-
const startDate =
|
|
195
|
-
new Date(Date.now() - 7 * 86400000).toISOString().split('T')[0] ?? ''
|
|
196
|
-
|
|
197
|
-
const entries = db.searchByDateRange(startDate, endDate)
|
|
198
|
-
|
|
199
|
-
return {
|
|
200
|
-
messages: [
|
|
201
|
-
{
|
|
202
|
-
role: 'user',
|
|
203
|
-
content: {
|
|
204
|
-
type: 'text',
|
|
205
|
-
text: `Create a weekly digest from these entries:\n\n${entries.map((e) => `[${e.timestamp}] ${e.entryType}: ${e.content.slice(0, 150)}`).join('\n\n')}\n\nFormat as day-by-day summary with highlights.`,
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
}
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
name: 'analyze-period',
|
|
214
|
-
description: 'Deep period analysis with insights',
|
|
215
|
-
icons: [ICON_PROMPT],
|
|
216
|
-
arguments: [
|
|
217
|
-
{ name: 'start_date', description: 'Start date (YYYY-MM-DD)', required: true },
|
|
218
|
-
{ name: 'end_date', description: 'End date (YYYY-MM-DD)', required: true },
|
|
219
|
-
],
|
|
220
|
-
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
221
|
-
const startDate = args['start_date'] ?? ''
|
|
222
|
-
const endDate = args['end_date'] ?? ''
|
|
223
|
-
|
|
224
|
-
const entries = db.searchByDateRange(startDate, endDate)
|
|
225
|
-
const stats = db.getStatistics('day')
|
|
226
|
-
|
|
227
|
-
return {
|
|
228
|
-
messages: [
|
|
229
|
-
{
|
|
230
|
-
role: 'user',
|
|
231
|
-
content: {
|
|
232
|
-
type: 'text',
|
|
233
|
-
text: `Analyze the period ${startDate} to ${endDate}:\n\nStatistics: ${JSON.stringify(stats, null, 2)}\n\nEntries (${String(entries.length)} total):\n${entries
|
|
234
|
-
.slice(0, 15)
|
|
235
|
-
.map(
|
|
236
|
-
(e) =>
|
|
237
|
-
`[${e.timestamp}] ${e.entryType}: ${e.content.slice(0, 100)}`
|
|
238
|
-
)
|
|
239
|
-
.join(
|
|
240
|
-
'\n'
|
|
241
|
-
)}\n\nProvide insights on patterns, productivity, and recommendations.`,
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
],
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
name: 'goal-tracker',
|
|
250
|
-
description: 'Milestone and achievement tracking',
|
|
251
|
-
icons: [ICON_PROMPT],
|
|
252
|
-
arguments: [],
|
|
253
|
-
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
254
|
-
const entries = execQuery(
|
|
255
|
-
db,
|
|
256
|
-
`
|
|
257
|
-
SELECT * FROM memory_journal
|
|
258
|
-
WHERE significance_type IS NOT NULL
|
|
259
|
-
AND deleted_at IS NULL
|
|
260
|
-
ORDER BY timestamp DESC
|
|
261
|
-
LIMIT 20
|
|
262
|
-
`
|
|
263
|
-
)
|
|
264
|
-
|
|
265
|
-
return {
|
|
266
|
-
messages: [
|
|
267
|
-
{
|
|
268
|
-
role: 'user',
|
|
269
|
-
content: {
|
|
270
|
-
type: 'text',
|
|
271
|
-
text: `Track goals and milestones based on significant entries:\n\n${JSON.stringify(entries, null, 2)}\n\nSummarize progress toward goals and highlight achievements.`,
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
name: 'get-context-bundle',
|
|
280
|
-
description: 'Project context with recent entries, statistics, and GitHub status hints',
|
|
281
|
-
icons: [ICON_PROMPT],
|
|
282
|
-
arguments: [],
|
|
283
|
-
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
284
|
-
const recent = db.getRecentEntries(5)
|
|
285
|
-
const stats = db.getStatistics('week')
|
|
286
|
-
|
|
287
|
-
// Compact entry summaries (ID + type + preview) instead of full content
|
|
288
|
-
const entrySummaries = recent.map((e) => ({
|
|
289
|
-
id: e.id,
|
|
290
|
-
type: e.entryType,
|
|
291
|
-
timestamp: e.timestamp,
|
|
292
|
-
preview: e.content.slice(0, 60) + (e.content.length > 60 ? '...' : ''),
|
|
293
|
-
}))
|
|
294
|
-
|
|
295
|
-
return {
|
|
296
|
-
messages: [
|
|
297
|
-
{
|
|
298
|
-
role: 'user',
|
|
299
|
-
content: {
|
|
300
|
-
type: 'text',
|
|
301
|
-
text: `Project context bundle:
|
|
302
|
-
|
|
303
|
-
**Recent Entries (${String(recent.length)}):**
|
|
304
|
-
${entrySummaries.map((e) => `- #${String(e.id)} (${e.type}) ${e.preview}`).join('\n')}
|
|
305
|
-
|
|
306
|
-
**Statistics:** ${JSON.stringify(stats)}
|
|
307
|
-
|
|
308
|
-
**For full GitHub status:** Fetch \`memory://github/status\`
|
|
309
|
-
**For full entry details:** Use \`get_entry_by_id\` with entry ID`,
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
|
-
],
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
name: 'get-recent-entries',
|
|
318
|
-
description: 'Formatted recent entries',
|
|
319
|
-
icons: [ICON_PROMPT],
|
|
320
|
-
arguments: [
|
|
321
|
-
{ name: 'limit', description: 'Number of entries (default: 10)', required: false },
|
|
322
|
-
],
|
|
323
|
-
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
324
|
-
const limit = parseInt(args['limit'] ?? '10', 10)
|
|
325
|
-
const entries = db.getRecentEntries(limit)
|
|
326
|
-
|
|
327
|
-
return {
|
|
328
|
-
messages: [
|
|
329
|
-
{
|
|
330
|
-
role: 'user',
|
|
331
|
-
content: {
|
|
332
|
-
type: 'text',
|
|
333
|
-
text: `Recent ${String(limit)} entries:\n\n${entries.map((e) => `## ${e.timestamp} (${e.entryType})\n\n${e.content}\n\nTags: ${e.tags.join(', ') || 'none'}`).join('\n\n---\n\n')}`,
|
|
334
|
-
},
|
|
335
|
-
},
|
|
336
|
-
],
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
name: 'project-status-summary',
|
|
342
|
-
description: 'GitHub Project status reports',
|
|
343
|
-
icons: [ICON_PROMPT],
|
|
344
|
-
arguments: [
|
|
345
|
-
{ name: 'project_number', description: 'GitHub Project number', required: true },
|
|
346
|
-
],
|
|
347
|
-
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
348
|
-
const projectNumber = parseInt(args['project_number'] ?? '0', 10)
|
|
349
|
-
const entries = execQuery(
|
|
350
|
-
db,
|
|
351
|
-
`
|
|
352
|
-
SELECT * FROM memory_journal
|
|
353
|
-
WHERE project_number = ?
|
|
354
|
-
AND deleted_at IS NULL
|
|
355
|
-
ORDER BY timestamp DESC
|
|
356
|
-
LIMIT 20
|
|
357
|
-
`,
|
|
358
|
-
[projectNumber]
|
|
359
|
-
)
|
|
360
|
-
|
|
361
|
-
return {
|
|
362
|
-
messages: [
|
|
363
|
-
{
|
|
364
|
-
role: 'user',
|
|
365
|
-
content: {
|
|
366
|
-
type: 'text',
|
|
367
|
-
text: `Generate a status summary for Project #${String(projectNumber)}:\n\nEntries: ${JSON.stringify(entries, null, 2)}\n\nProvide: overview, recent activity, blockers, next steps.`,
|
|
368
|
-
},
|
|
369
|
-
},
|
|
370
|
-
],
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
},
|
|
374
|
-
{
|
|
375
|
-
name: 'pr-summary',
|
|
376
|
-
description: 'Pull request journal activity summary',
|
|
377
|
-
icons: [ICON_PROMPT],
|
|
378
|
-
arguments: [{ name: 'pr_number', description: 'Pull request number', required: true }],
|
|
379
|
-
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
380
|
-
const prNumber = parseInt(args['pr_number'] ?? '0', 10)
|
|
381
|
-
const entries = execQuery(
|
|
382
|
-
db,
|
|
383
|
-
`
|
|
384
|
-
SELECT * FROM memory_journal
|
|
385
|
-
WHERE pr_number = ?
|
|
386
|
-
AND deleted_at IS NULL
|
|
387
|
-
ORDER BY timestamp ASC
|
|
388
|
-
`,
|
|
389
|
-
[prNumber]
|
|
390
|
-
)
|
|
391
|
-
|
|
392
|
-
return {
|
|
393
|
-
messages: [
|
|
394
|
-
{
|
|
395
|
-
role: 'user',
|
|
396
|
-
content: {
|
|
397
|
-
type: 'text',
|
|
398
|
-
text: `Summarize PR #${String(prNumber)} activity:\n\nJournal entries: ${JSON.stringify(entries, null, 2)}\n\nProvide: summary of changes, decisions made, testing done.`,
|
|
399
|
-
},
|
|
400
|
-
},
|
|
401
|
-
],
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
name: 'code-review-prep',
|
|
407
|
-
description: 'Comprehensive PR review preparation',
|
|
408
|
-
icons: [ICON_PROMPT],
|
|
409
|
-
arguments: [{ name: 'pr_number', description: 'Pull request number', required: true }],
|
|
410
|
-
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
411
|
-
const prNumber = parseInt(args['pr_number'] ?? '0', 10)
|
|
412
|
-
const entries = execQuery(
|
|
413
|
-
db,
|
|
414
|
-
`
|
|
415
|
-
SELECT * FROM memory_journal
|
|
416
|
-
WHERE pr_number = ?
|
|
417
|
-
AND deleted_at IS NULL
|
|
418
|
-
ORDER BY timestamp ASC
|
|
419
|
-
`,
|
|
420
|
-
[prNumber]
|
|
421
|
-
)
|
|
422
|
-
|
|
423
|
-
return {
|
|
424
|
-
messages: [
|
|
425
|
-
{
|
|
426
|
-
role: 'user',
|
|
427
|
-
content: {
|
|
428
|
-
type: 'text',
|
|
429
|
-
text: `Prepare for code review of PR #${String(prNumber)}:\n\nContext entries: ${JSON.stringify(entries, null, 2)}\n\nProvide: review checklist, areas of concern, testing recommendations.`,
|
|
430
|
-
},
|
|
431
|
-
},
|
|
432
|
-
],
|
|
433
|
-
}
|
|
434
|
-
},
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
name: 'pr-retrospective',
|
|
438
|
-
description: 'Completed PR analysis with learnings',
|
|
439
|
-
icons: [ICON_PROMPT],
|
|
440
|
-
arguments: [{ name: 'pr_number', description: 'Pull request number', required: true }],
|
|
441
|
-
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
442
|
-
const prNumber = parseInt(args['pr_number'] ?? '0', 10)
|
|
443
|
-
const entries = execQuery(
|
|
444
|
-
db,
|
|
445
|
-
`
|
|
446
|
-
SELECT * FROM memory_journal
|
|
447
|
-
WHERE pr_number = ?
|
|
448
|
-
AND deleted_at IS NULL
|
|
449
|
-
ORDER BY timestamp ASC
|
|
450
|
-
`,
|
|
451
|
-
[prNumber]
|
|
452
|
-
)
|
|
453
|
-
|
|
454
|
-
return {
|
|
455
|
-
messages: [
|
|
456
|
-
{
|
|
457
|
-
role: 'user',
|
|
458
|
-
content: {
|
|
459
|
-
type: 'text',
|
|
460
|
-
text: `Retrospective for PR #${String(prNumber)}:\n\nJournal entries: ${JSON.stringify(entries, null, 2)}\n\nProvide: what went well, challenges, lessons learned.`,
|
|
461
|
-
},
|
|
462
|
-
},
|
|
463
|
-
],
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
name: 'actions-failure-digest',
|
|
469
|
-
description: 'CI/CD failure analysis with root cause identification',
|
|
470
|
-
icons: [ICON_PROMPT],
|
|
471
|
-
arguments: [],
|
|
472
|
-
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
473
|
-
const entries = execQuery(
|
|
474
|
-
db,
|
|
475
|
-
`
|
|
476
|
-
SELECT * FROM memory_journal
|
|
477
|
-
WHERE workflow_run_id IS NOT NULL
|
|
478
|
-
AND deleted_at IS NULL
|
|
479
|
-
ORDER BY timestamp DESC
|
|
480
|
-
LIMIT 20
|
|
481
|
-
`
|
|
482
|
-
)
|
|
483
|
-
|
|
484
|
-
return {
|
|
485
|
-
messages: [
|
|
486
|
-
{
|
|
487
|
-
role: 'user',
|
|
488
|
-
content: {
|
|
489
|
-
type: 'text',
|
|
490
|
-
text: `Analyze CI/CD failures from these workflow entries:\n\n${JSON.stringify(entries, null, 2)}\n\nProvide: failure patterns, root causes, remediation steps.`,
|
|
491
|
-
},
|
|
492
|
-
},
|
|
493
|
-
],
|
|
494
|
-
}
|
|
495
|
-
},
|
|
496
|
-
},
|
|
497
|
-
{
|
|
498
|
-
name: 'project-milestone-tracker',
|
|
499
|
-
description: 'Milestone progress tracking',
|
|
500
|
-
icons: [ICON_PROMPT],
|
|
501
|
-
arguments: [
|
|
502
|
-
{ name: 'project_number', description: 'GitHub Project number', required: true },
|
|
503
|
-
],
|
|
504
|
-
handler: (args: Record<string, string>, db: SqliteAdapter) => {
|
|
505
|
-
const projectNumber = parseInt(args['project_number'] ?? '0', 10)
|
|
506
|
-
const entries = execQuery(
|
|
507
|
-
db,
|
|
508
|
-
`
|
|
509
|
-
SELECT * FROM memory_journal
|
|
510
|
-
WHERE project_number = ?
|
|
511
|
-
AND significance_type IS NOT NULL
|
|
512
|
-
AND deleted_at IS NULL
|
|
513
|
-
ORDER BY timestamp DESC
|
|
514
|
-
`,
|
|
515
|
-
[projectNumber]
|
|
516
|
-
)
|
|
517
|
-
|
|
518
|
-
return {
|
|
519
|
-
messages: [
|
|
520
|
-
{
|
|
521
|
-
role: 'user',
|
|
522
|
-
content: {
|
|
523
|
-
type: 'text',
|
|
524
|
-
text: `Track milestones for Project #${String(projectNumber)}:\n\nMilestone entries: ${JSON.stringify(entries, null, 2)}\n\nProvide: progress summary, upcoming milestones, timeline.`,
|
|
525
|
-
},
|
|
526
|
-
},
|
|
527
|
-
],
|
|
528
|
-
}
|
|
529
|
-
},
|
|
530
|
-
},
|
|
531
|
-
{
|
|
532
|
-
name: 'confirm-briefing',
|
|
533
|
-
description:
|
|
534
|
-
'Acknowledge session context received from memory://briefing to inform the user',
|
|
535
|
-
icons: [ICON_PROMPT],
|
|
536
|
-
arguments: [],
|
|
537
|
-
handler: (_args: Record<string, string>, db: SqliteAdapter) => {
|
|
538
|
-
// Get the same data that memory://briefing would provide
|
|
539
|
-
const recent = db.getRecentEntries(3)
|
|
540
|
-
const stats = db.getStatistics('week')
|
|
541
|
-
const totalEntries = stats.totalEntries ?? 0
|
|
542
|
-
|
|
543
|
-
// Build entry summary
|
|
544
|
-
const entrySummary =
|
|
545
|
-
recent.length > 0
|
|
546
|
-
? recent
|
|
547
|
-
.map(
|
|
548
|
-
(e) =>
|
|
549
|
-
` - #${String(e.id)} (${e.entryType}) ${e.content.slice(0, 40)}...`
|
|
550
|
-
)
|
|
551
|
-
.join('\n')
|
|
552
|
-
: ' - No entries yet'
|
|
553
|
-
|
|
554
|
-
return {
|
|
555
|
-
messages: [
|
|
556
|
-
{
|
|
557
|
-
role: 'user',
|
|
558
|
-
content: {
|
|
559
|
-
type: 'text',
|
|
560
|
-
text: `Generate a briefing acknowledgment for the user with this context:
|
|
561
|
-
|
|
562
|
-
**Session Context Received:**
|
|
563
|
-
- **Journal**: ${String(totalEntries)} total entries
|
|
564
|
-
- **Latest Entries**:
|
|
565
|
-
${entrySummary}
|
|
566
|
-
|
|
567
|
-
**My Behaviors:**
|
|
568
|
-
- Create entries for: implementations, decisions, bug fixes, milestones
|
|
569
|
-
- Search before: major decisions, referencing prior work
|
|
570
|
-
- Link entries: implementation→spec, bugfix→issue
|
|
571
|
-
|
|
572
|
-
**For More Context:**
|
|
573
|
-
- Full entries: \`memory://recent\` or \`get_entry_by_id(ID)\`
|
|
574
|
-
- GitHub status: \`memory://github/status\`
|
|
575
|
-
- Repo insights: \`memory://github/insights\` (stars, traffic, clones)
|
|
576
|
-
- Full health: \`memory://health\`
|
|
577
|
-
|
|
578
|
-
Please confirm this context to the user in a concise, friendly format. Use a table if helpful.`,
|
|
579
|
-
},
|
|
580
|
-
},
|
|
581
|
-
],
|
|
582
|
-
}
|
|
583
|
-
},
|
|
584
|
-
},
|
|
585
|
-
]
|
|
96
|
+
return [...getWorkflowPromptDefinitions(), ...getGitHubPromptDefinitions()]
|
|
586
97
|
}
|