engram-mcp-server 1.2.8 → 1.2.9
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 +12 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -1
- package/dist/constants.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/installer/ide-detector.d.ts.map +1 -1
- package/dist/installer/ide-detector.js +10 -6
- package/dist/installer/ide-detector.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +79 -15
- package/dist/installer/index.js.map +1 -1
- package/package.json +6 -3
- package/dist/installer.d.ts +0 -2
- package/dist/installer.d.ts.map +0 -1
- package/dist/installer.js +0 -315
- package/dist/installer.js.map +0 -1
- package/dist/src/constants.d.ts +0 -21
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -81
- package/dist/src/constants.js.map +0 -1
- package/dist/src/database.d.ts +0 -32
- package/dist/src/database.d.ts.map +0 -1
- package/dist/src/database.js +0 -143
- package/dist/src/database.js.map +0 -1
- package/dist/src/errors.d.ts +0 -40
- package/dist/src/errors.d.ts.map +0 -1
- package/dist/src/errors.js +0 -63
- package/dist/src/errors.js.map +0 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -89
- package/dist/src/index.js.map +0 -1
- package/dist/src/installer/config-writer.d.ts +0 -25
- package/dist/src/installer/config-writer.d.ts.map +0 -1
- package/dist/src/installer/config-writer.js +0 -86
- package/dist/src/installer/config-writer.js.map +0 -1
- package/dist/src/installer/ide-configs.d.ts +0 -19
- package/dist/src/installer/ide-configs.d.ts.map +0 -1
- package/dist/src/installer/ide-configs.js +0 -131
- package/dist/src/installer/ide-configs.js.map +0 -1
- package/dist/src/installer/ide-detector.d.ts +0 -6
- package/dist/src/installer/ide-detector.d.ts.map +0 -1
- package/dist/src/installer/ide-detector.js +0 -45
- package/dist/src/installer/ide-detector.js.map +0 -1
- package/dist/src/installer/index.d.ts +0 -2
- package/dist/src/installer/index.d.ts.map +0 -1
- package/dist/src/installer/index.js +0 -229
- package/dist/src/installer/index.js.map +0 -1
- package/dist/src/logger.d.ts +0 -10
- package/dist/src/logger.d.ts.map +0 -1
- package/dist/src/logger.js +0 -51
- package/dist/src/logger.js.map +0 -1
- package/dist/src/migrations.d.ts +0 -4
- package/dist/src/migrations.d.ts.map +0 -1
- package/dist/src/migrations.js +0 -343
- package/dist/src/migrations.js.map +0 -1
- package/dist/src/repositories/changes.repo.d.ts +0 -35
- package/dist/src/repositories/changes.repo.d.ts.map +0 -1
- package/dist/src/repositories/changes.repo.js +0 -53
- package/dist/src/repositories/changes.repo.js.map +0 -1
- package/dist/src/repositories/config.repo.d.ts +0 -11
- package/dist/src/repositories/config.repo.d.ts.map +0 -1
- package/dist/src/repositories/config.repo.js +0 -38
- package/dist/src/repositories/config.repo.js.map +0 -1
- package/dist/src/repositories/conventions.repo.d.ts +0 -15
- package/dist/src/repositories/conventions.repo.d.ts.map +0 -1
- package/dist/src/repositories/conventions.repo.js +0 -39
- package/dist/src/repositories/conventions.repo.js.map +0 -1
- package/dist/src/repositories/decisions.repo.d.ts +0 -19
- package/dist/src/repositories/decisions.repo.d.ts.map +0 -1
- package/dist/src/repositories/decisions.repo.js +0 -48
- package/dist/src/repositories/decisions.repo.js.map +0 -1
- package/dist/src/repositories/events.repo.d.ts +0 -34
- package/dist/src/repositories/events.repo.d.ts.map +0 -1
- package/dist/src/repositories/events.repo.js +0 -71
- package/dist/src/repositories/events.repo.js.map +0 -1
- package/dist/src/repositories/file-notes.repo.d.ts +0 -26
- package/dist/src/repositories/file-notes.repo.d.ts.map +0 -1
- package/dist/src/repositories/file-notes.repo.js +0 -55
- package/dist/src/repositories/file-notes.repo.js.map +0 -1
- package/dist/src/repositories/index.d.ts +0 -38
- package/dist/src/repositories/index.d.ts.map +0 -1
- package/dist/src/repositories/index.js +0 -41
- package/dist/src/repositories/index.js.map +0 -1
- package/dist/src/repositories/milestones.repo.d.ts +0 -10
- package/dist/src/repositories/milestones.repo.d.ts.map +0 -1
- package/dist/src/repositories/milestones.repo.js +0 -20
- package/dist/src/repositories/milestones.repo.js.map +0 -1
- package/dist/src/repositories/sessions.repo.d.ts +0 -27
- package/dist/src/repositories/sessions.repo.d.ts.map +0 -1
- package/dist/src/repositories/sessions.repo.js +0 -61
- package/dist/src/repositories/sessions.repo.js.map +0 -1
- package/dist/src/repositories/snapshot.repo.d.ts +0 -11
- package/dist/src/repositories/snapshot.repo.d.ts.map +0 -1
- package/dist/src/repositories/snapshot.repo.js +0 -17
- package/dist/src/repositories/snapshot.repo.js.map +0 -1
- package/dist/src/repositories/tasks.repo.d.ts +0 -40
- package/dist/src/repositories/tasks.repo.d.ts.map +0 -1
- package/dist/src/repositories/tasks.repo.js +0 -90
- package/dist/src/repositories/tasks.repo.js.map +0 -1
- package/dist/src/response.d.ts +0 -28
- package/dist/src/response.d.ts.map +0 -1
- package/dist/src/response.js +0 -38
- package/dist/src/response.js.map +0 -1
- package/dist/src/scripts/install-hooks.d.ts +0 -3
- package/dist/src/scripts/install-hooks.d.ts.map +0 -1
- package/dist/src/scripts/install-hooks.js +0 -89
- package/dist/src/scripts/install-hooks.js.map +0 -1
- package/dist/src/services/compaction.service.d.ts +0 -27
- package/dist/src/services/compaction.service.d.ts.map +0 -1
- package/dist/src/services/compaction.service.js +0 -93
- package/dist/src/services/compaction.service.js.map +0 -1
- package/dist/src/services/event-trigger.service.d.ts +0 -24
- package/dist/src/services/event-trigger.service.d.ts.map +0 -1
- package/dist/src/services/event-trigger.service.js +0 -60
- package/dist/src/services/event-trigger.service.js.map +0 -1
- package/dist/src/services/git.service.d.ts +0 -20
- package/dist/src/services/git.service.d.ts.map +0 -1
- package/dist/src/services/git.service.js +0 -88
- package/dist/src/services/git.service.js.map +0 -1
- package/dist/src/services/index.d.ts +0 -5
- package/dist/src/services/index.d.ts.map +0 -1
- package/dist/src/services/index.js +0 -8
- package/dist/src/services/index.js.map +0 -1
- package/dist/src/services/project-scan.service.d.ts +0 -19
- package/dist/src/services/project-scan.service.d.ts.map +0 -1
- package/dist/src/services/project-scan.service.js +0 -66
- package/dist/src/services/project-scan.service.js.map +0 -1
- package/dist/src/tools/backup.d.ts +0 -3
- package/dist/src/tools/backup.d.ts.map +0 -1
- package/dist/src/tools/backup.js +0 -191
- package/dist/src/tools/backup.js.map +0 -1
- package/dist/src/tools/changes.d.ts +0 -3
- package/dist/src/tools/changes.d.ts.map +0 -1
- package/dist/src/tools/changes.js +0 -97
- package/dist/src/tools/changes.js.map +0 -1
- package/dist/src/tools/compaction.d.ts +0 -3
- package/dist/src/tools/compaction.d.ts.map +0 -1
- package/dist/src/tools/compaction.js +0 -151
- package/dist/src/tools/compaction.js.map +0 -1
- package/dist/src/tools/conventions.d.ts +0 -3
- package/dist/src/tools/conventions.d.ts.map +0 -1
- package/dist/src/tools/conventions.js +0 -121
- package/dist/src/tools/conventions.js.map +0 -1
- package/dist/src/tools/decisions.d.ts +0 -3
- package/dist/src/tools/decisions.d.ts.map +0 -1
- package/dist/src/tools/decisions.js +0 -136
- package/dist/src/tools/decisions.js.map +0 -1
- package/dist/src/tools/export-import.d.ts +0 -3
- package/dist/src/tools/export-import.d.ts.map +0 -1
- package/dist/src/tools/export-import.js +0 -180
- package/dist/src/tools/export-import.js.map +0 -1
- package/dist/src/tools/file-notes.d.ts +0 -3
- package/dist/src/tools/file-notes.d.ts.map +0 -1
- package/dist/src/tools/file-notes.js +0 -104
- package/dist/src/tools/file-notes.js.map +0 -1
- package/dist/src/tools/intelligence.d.ts +0 -3
- package/dist/src/tools/intelligence.d.ts.map +0 -1
- package/dist/src/tools/intelligence.js +0 -427
- package/dist/src/tools/intelligence.js.map +0 -1
- package/dist/src/tools/milestones.d.ts +0 -3
- package/dist/src/tools/milestones.d.ts.map +0 -1
- package/dist/src/tools/milestones.js +0 -71
- package/dist/src/tools/milestones.js.map +0 -1
- package/dist/src/tools/scheduler.d.ts +0 -3
- package/dist/src/tools/scheduler.d.ts.map +0 -1
- package/dist/src/tools/scheduler.js +0 -363
- package/dist/src/tools/scheduler.js.map +0 -1
- package/dist/src/tools/sessions.d.ts +0 -3
- package/dist/src/tools/sessions.d.ts.map +0 -1
- package/dist/src/tools/sessions.js +0 -356
- package/dist/src/tools/sessions.js.map +0 -1
- package/dist/src/tools/stats.d.ts +0 -3
- package/dist/src/tools/stats.d.ts.map +0 -1
- package/dist/src/tools/stats.js +0 -63
- package/dist/src/tools/stats.js.map +0 -1
- package/dist/src/tools/tasks.d.ts +0 -3
- package/dist/src/tools/tasks.d.ts.map +0 -1
- package/dist/src/tools/tasks.js +0 -206
- package/dist/src/tools/tasks.js.map +0 -1
- package/dist/src/types.d.ts +0 -170
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -5
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils.d.ts +0 -58
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js +0 -190
- package/dist/src/utils.js.map +0 -1
- package/dist/tests/helpers/test-db.d.ts +0 -12
- package/dist/tests/helpers/test-db.d.ts.map +0 -1
- package/dist/tests/helpers/test-db.js +0 -149
- package/dist/tests/helpers/test-db.js.map +0 -1
- package/dist/tests/installer/installer.test.d.ts +0 -2
- package/dist/tests/installer/installer.test.d.ts.map +0 -1
- package/dist/tests/installer/installer.test.js +0 -160
- package/dist/tests/installer/installer.test.js.map +0 -1
- package/dist/tests/repositories/repos.test.d.ts +0 -2
- package/dist/tests/repositories/repos.test.d.ts.map +0 -1
- package/dist/tests/repositories/repos.test.js +0 -220
- package/dist/tests/repositories/repos.test.js.map +0 -1
- package/dist/tools/maintenance.d.ts +0 -3
- package/dist/tools/maintenance.d.ts.map +0 -1
- package/dist/tools/maintenance.js +0 -647
- package/dist/tools/maintenance.js.map +0 -1
- package/dist/tools/memory.d.ts +0 -3
- package/dist/tools/memory.d.ts.map +0 -1
- package/dist/tools/memory.js +0 -446
- package/dist/tools/memory.js.map +0 -1
package/dist/src/tools/tasks.js
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// Engram MCP Server — Task Management Tools
|
|
3
|
-
// ============================================================================
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import { getDb, now, getCurrentSessionId } from "../database.js";
|
|
6
|
-
import { TOOL_PREFIX } from "../constants.js";
|
|
7
|
-
export function registerTaskTools(server) {
|
|
8
|
-
// ─── CREATE TASK ────────────────────────────────────────────────────
|
|
9
|
-
server.registerTool(`${TOOL_PREFIX}_create_task`, {
|
|
10
|
-
title: "Create Task",
|
|
11
|
-
description: `Create a work item that persists across sessions. Tasks ensure continuity — nothing falls through the cracks between sessions. Use for TODOs, bugs, features, or any work that needs tracking.
|
|
12
|
-
|
|
13
|
-
Args:
|
|
14
|
-
- title (string): Short, descriptive task title
|
|
15
|
-
- description (string, optional): Detailed description of the work
|
|
16
|
-
- priority: "critical" | "high" | "medium" | "low" (default: "medium")
|
|
17
|
-
- status: "backlog" | "in_progress" | "blocked" | "review" (default: "backlog")
|
|
18
|
-
- assigned_files (array, optional): Files this task relates to
|
|
19
|
-
- tags (array, optional): Categorization tags
|
|
20
|
-
- blocked_by (array of numbers, optional): Task IDs that block this task
|
|
21
|
-
|
|
22
|
-
Returns:
|
|
23
|
-
Task ID and confirmation.`,
|
|
24
|
-
inputSchema: {
|
|
25
|
-
title: z.string().min(3).describe("Short task title"),
|
|
26
|
-
description: z.string().optional().describe("Detailed description"),
|
|
27
|
-
priority: z.enum(["critical", "high", "medium", "low"]).default("medium"),
|
|
28
|
-
status: z.enum(["backlog", "in_progress", "blocked", "review"]).default("backlog"),
|
|
29
|
-
assigned_files: z.array(z.string()).optional().describe("Related files"),
|
|
30
|
-
tags: z.array(z.string()).optional().describe("Tags"),
|
|
31
|
-
blocked_by: z.array(z.number().int()).optional().describe("Blocking task IDs"),
|
|
32
|
-
},
|
|
33
|
-
annotations: {
|
|
34
|
-
readOnlyHint: false,
|
|
35
|
-
destructiveHint: false,
|
|
36
|
-
idempotentHint: false,
|
|
37
|
-
openWorldHint: false,
|
|
38
|
-
},
|
|
39
|
-
}, async ({ title, description, priority, status, assigned_files, tags, blocked_by }) => {
|
|
40
|
-
const db = getDb();
|
|
41
|
-
const timestamp = now();
|
|
42
|
-
const sessionId = getCurrentSessionId();
|
|
43
|
-
const result = db.prepare(`
|
|
44
|
-
INSERT INTO tasks (session_id, created_at, updated_at, title, description, status, priority, assigned_files, tags, blocked_by)
|
|
45
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
46
|
-
`).run(sessionId, timestamp, timestamp, title, description || null, status, priority, assigned_files ? JSON.stringify(assigned_files) : null, tags ? JSON.stringify(tags) : null, blocked_by ? JSON.stringify(blocked_by) : null);
|
|
47
|
-
return {
|
|
48
|
-
content: [{
|
|
49
|
-
type: "text",
|
|
50
|
-
text: JSON.stringify({
|
|
51
|
-
task_id: result.lastInsertRowid,
|
|
52
|
-
message: `Task #${result.lastInsertRowid} created: "${title}" [${priority}/${status}]`,
|
|
53
|
-
}, null, 2),
|
|
54
|
-
}],
|
|
55
|
-
};
|
|
56
|
-
});
|
|
57
|
-
// ─── UPDATE TASK ────────────────────────────────────────────────────
|
|
58
|
-
server.registerTool(`${TOOL_PREFIX}_update_task`, {
|
|
59
|
-
title: "Update Task",
|
|
60
|
-
description: `Update a task's status, priority, or other fields. Use when progressing, completing, or blocking tasks.
|
|
61
|
-
|
|
62
|
-
Args:
|
|
63
|
-
- id (number): Task ID to update
|
|
64
|
-
- status (string, optional): New status
|
|
65
|
-
- priority (string, optional): New priority
|
|
66
|
-
- description (string, optional): Updated description
|
|
67
|
-
- blocked_by (array, optional): Updated blocking task IDs
|
|
68
|
-
- assigned_files (array, optional): Updated related files
|
|
69
|
-
- tags (array, optional): Updated tags
|
|
70
|
-
|
|
71
|
-
Returns:
|
|
72
|
-
Updated task.`,
|
|
73
|
-
inputSchema: {
|
|
74
|
-
id: z.number().int().describe("Task ID"),
|
|
75
|
-
status: z.enum(["backlog", "in_progress", "blocked", "review", "done", "cancelled"]).optional(),
|
|
76
|
-
priority: z.enum(["critical", "high", "medium", "low"]).optional(),
|
|
77
|
-
description: z.string().optional(),
|
|
78
|
-
blocked_by: z.array(z.number().int()).optional(),
|
|
79
|
-
assigned_files: z.array(z.string()).optional(),
|
|
80
|
-
tags: z.array(z.string()).optional(),
|
|
81
|
-
},
|
|
82
|
-
annotations: {
|
|
83
|
-
readOnlyHint: false,
|
|
84
|
-
destructiveHint: false,
|
|
85
|
-
idempotentHint: true,
|
|
86
|
-
openWorldHint: false,
|
|
87
|
-
},
|
|
88
|
-
}, async ({ id, status, priority, description, blocked_by, assigned_files, tags }) => {
|
|
89
|
-
const db = getDb();
|
|
90
|
-
const timestamp = now();
|
|
91
|
-
// Build dynamic update
|
|
92
|
-
const updates = ["updated_at = ?"];
|
|
93
|
-
const params = [timestamp];
|
|
94
|
-
if (status) {
|
|
95
|
-
updates.push("status = ?");
|
|
96
|
-
params.push(status);
|
|
97
|
-
if (status === "done" || status === "cancelled") {
|
|
98
|
-
updates.push("completed_at = ?");
|
|
99
|
-
params.push(timestamp);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (priority) {
|
|
103
|
-
updates.push("priority = ?");
|
|
104
|
-
params.push(priority);
|
|
105
|
-
}
|
|
106
|
-
if (description !== undefined) {
|
|
107
|
-
updates.push("description = ?");
|
|
108
|
-
params.push(description);
|
|
109
|
-
}
|
|
110
|
-
if (blocked_by) {
|
|
111
|
-
updates.push("blocked_by = ?");
|
|
112
|
-
params.push(JSON.stringify(blocked_by));
|
|
113
|
-
}
|
|
114
|
-
if (assigned_files) {
|
|
115
|
-
updates.push("assigned_files = ?");
|
|
116
|
-
params.push(JSON.stringify(assigned_files));
|
|
117
|
-
}
|
|
118
|
-
if (tags) {
|
|
119
|
-
updates.push("tags = ?");
|
|
120
|
-
params.push(JSON.stringify(tags));
|
|
121
|
-
}
|
|
122
|
-
params.push(id);
|
|
123
|
-
const result = db.prepare(`UPDATE tasks SET ${updates.join(", ")} WHERE id = ?`).run(...params);
|
|
124
|
-
if (result.changes === 0) {
|
|
125
|
-
return { isError: true, content: [{ type: "text", text: `Task #${id} not found.` }] };
|
|
126
|
-
}
|
|
127
|
-
// If task was marked done, trigger any scheduled events waiting on it
|
|
128
|
-
let triggeredEventCount = 0;
|
|
129
|
-
if (status === "done") {
|
|
130
|
-
try {
|
|
131
|
-
const triggerResult = db.prepare(`UPDATE scheduled_events SET status = 'triggered', triggered_at = ?
|
|
132
|
-
WHERE status = 'pending' AND trigger_type = 'task_complete' AND trigger_value = ?`).run(timestamp, String(id));
|
|
133
|
-
triggeredEventCount = triggerResult.changes;
|
|
134
|
-
}
|
|
135
|
-
catch { /* scheduled_events table may not exist yet */ }
|
|
136
|
-
}
|
|
137
|
-
const updated = db.prepare("SELECT * FROM tasks WHERE id = ?").get(id);
|
|
138
|
-
const response = { ...updated };
|
|
139
|
-
if (triggeredEventCount > 0) {
|
|
140
|
-
response._triggered_events = `${triggeredEventCount} scheduled event(s) triggered by this task completion. Use engram_check_events to review.`;
|
|
141
|
-
}
|
|
142
|
-
return { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] };
|
|
143
|
-
});
|
|
144
|
-
// ─── GET TASKS ──────────────────────────────────────────────────────
|
|
145
|
-
server.registerTool(`${TOOL_PREFIX}_get_tasks`, {
|
|
146
|
-
title: "Get Tasks",
|
|
147
|
-
description: `Retrieve tasks with optional filtering. Returns open tasks by default.
|
|
148
|
-
|
|
149
|
-
Args:
|
|
150
|
-
- status (string, optional): Filter by status
|
|
151
|
-
- priority (string, optional): Filter by priority
|
|
152
|
-
- tag (string, optional): Filter by tag
|
|
153
|
-
- include_done (boolean, optional): Include completed/cancelled tasks (default: false)
|
|
154
|
-
- limit (number, optional): Max results (default 20)
|
|
155
|
-
|
|
156
|
-
Returns:
|
|
157
|
-
Array of tasks sorted by priority then creation date.`,
|
|
158
|
-
inputSchema: {
|
|
159
|
-
status: z.enum(["backlog", "in_progress", "blocked", "review", "done", "cancelled"]).optional(),
|
|
160
|
-
priority: z.enum(["critical", "high", "medium", "low"]).optional(),
|
|
161
|
-
tag: z.string().optional(),
|
|
162
|
-
include_done: z.boolean().default(false),
|
|
163
|
-
limit: z.number().int().min(1).max(100).default(20),
|
|
164
|
-
},
|
|
165
|
-
annotations: {
|
|
166
|
-
readOnlyHint: true,
|
|
167
|
-
destructiveHint: false,
|
|
168
|
-
idempotentHint: true,
|
|
169
|
-
openWorldHint: false,
|
|
170
|
-
},
|
|
171
|
-
}, async ({ status, priority, tag, include_done, limit }) => {
|
|
172
|
-
const db = getDb();
|
|
173
|
-
let query = "SELECT * FROM tasks WHERE 1=1";
|
|
174
|
-
const params = [];
|
|
175
|
-
if (!include_done) {
|
|
176
|
-
query += " AND status NOT IN ('done', 'cancelled')";
|
|
177
|
-
}
|
|
178
|
-
if (status) {
|
|
179
|
-
query += " AND status = ?";
|
|
180
|
-
params.push(status);
|
|
181
|
-
}
|
|
182
|
-
if (priority) {
|
|
183
|
-
query += " AND priority = ?";
|
|
184
|
-
params.push(priority);
|
|
185
|
-
}
|
|
186
|
-
if (tag) {
|
|
187
|
-
query += " AND EXISTS (SELECT 1 FROM json_each(tags) WHERE value = ?)";
|
|
188
|
-
params.push(tag);
|
|
189
|
-
}
|
|
190
|
-
// Sort: critical > high > medium > low, then by creation date
|
|
191
|
-
query += ` ORDER BY
|
|
192
|
-
CASE priority WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END,
|
|
193
|
-
created_at ASC
|
|
194
|
-
LIMIT ?`;
|
|
195
|
-
params.push(limit);
|
|
196
|
-
const tasks = db.prepare(query).all(...params);
|
|
197
|
-
const openCount = db.prepare("SELECT COUNT(*) as c FROM tasks WHERE status NOT IN ('done','cancelled')").get().c;
|
|
198
|
-
return {
|
|
199
|
-
content: [{
|
|
200
|
-
type: "text",
|
|
201
|
-
text: JSON.stringify({ total_open: openCount, returned: tasks.length, tasks }, null, 2),
|
|
202
|
-
}],
|
|
203
|
-
};
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
//# sourceMappingURL=tasks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/tools/tasks.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,4CAA4C;AAC5C,+EAA+E;AAG/E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9C,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,uEAAuE;IACvE,MAAM,CAAC,YAAY,CACjB,GAAG,WAAW,cAAc,EAC5B;QACE,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE;;;;;;;;;;;;4BAYS;QACtB,WAAW,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YACrD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;YACnE,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;YACzE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;YAClF,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAA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_name: string;
|
|
7
|
-
project_root: string;
|
|
8
|
-
tags: string | null;
|
|
9
|
-
parent_session_id: number | null;
|
|
10
|
-
}
|
|
11
|
-
export interface ChangeRow {
|
|
12
|
-
id: number;
|
|
13
|
-
session_id: number | null;
|
|
14
|
-
timestamp: string;
|
|
15
|
-
file_path: string;
|
|
16
|
-
change_type: ChangeType;
|
|
17
|
-
description: string;
|
|
18
|
-
diff_summary: string | null;
|
|
19
|
-
impact_scope: ImpactScope;
|
|
20
|
-
}
|
|
21
|
-
export interface DecisionRow {
|
|
22
|
-
id: number;
|
|
23
|
-
session_id: number | null;
|
|
24
|
-
timestamp: string;
|
|
25
|
-
decision: string;
|
|
26
|
-
rationale: string | null;
|
|
27
|
-
affected_files: string | null;
|
|
28
|
-
tags: string | null;
|
|
29
|
-
status: DecisionStatus;
|
|
30
|
-
superseded_by: number | null;
|
|
31
|
-
}
|
|
32
|
-
export interface FileNoteRow {
|
|
33
|
-
file_path: string;
|
|
34
|
-
purpose: string | null;
|
|
35
|
-
dependencies: string | null;
|
|
36
|
-
dependents: string | null;
|
|
37
|
-
layer: ArchLayer | null;
|
|
38
|
-
last_reviewed: string | null;
|
|
39
|
-
last_modified_session: number | null;
|
|
40
|
-
notes: string | null;
|
|
41
|
-
complexity: Complexity | null;
|
|
42
|
-
}
|
|
43
|
-
export interface ConventionRow {
|
|
44
|
-
id: number;
|
|
45
|
-
session_id: number | null;
|
|
46
|
-
timestamp: string;
|
|
47
|
-
category: ConventionCategory;
|
|
48
|
-
rule: string;
|
|
49
|
-
examples: string | null;
|
|
50
|
-
enforced: boolean;
|
|
51
|
-
}
|
|
52
|
-
export interface TaskRow {
|
|
53
|
-
id: number;
|
|
54
|
-
session_id: number | null;
|
|
55
|
-
created_at: string;
|
|
56
|
-
updated_at: string;
|
|
57
|
-
title: string;
|
|
58
|
-
description: string | null;
|
|
59
|
-
status: TaskStatus;
|
|
60
|
-
priority: TaskPriority;
|
|
61
|
-
assigned_files: string | null;
|
|
62
|
-
tags: string | null;
|
|
63
|
-
completed_at: string | null;
|
|
64
|
-
blocked_by: string | null;
|
|
65
|
-
}
|
|
66
|
-
export interface SnapshotRow {
|
|
67
|
-
key: string;
|
|
68
|
-
value: string;
|
|
69
|
-
updated_at: string;
|
|
70
|
-
ttl_minutes: number | null;
|
|
71
|
-
}
|
|
72
|
-
export interface MilestoneRow {
|
|
73
|
-
id: number;
|
|
74
|
-
session_id: number | null;
|
|
75
|
-
timestamp: string;
|
|
76
|
-
title: string;
|
|
77
|
-
description: string | null;
|
|
78
|
-
version: string | null;
|
|
79
|
-
tags: string | null;
|
|
80
|
-
}
|
|
81
|
-
export interface ScheduledEventRow {
|
|
82
|
-
id: number;
|
|
83
|
-
session_id: number | null;
|
|
84
|
-
created_at: string;
|
|
85
|
-
title: string;
|
|
86
|
-
description: string | null;
|
|
87
|
-
trigger_type: EventTriggerType;
|
|
88
|
-
trigger_value: string | null;
|
|
89
|
-
status: EventStatus;
|
|
90
|
-
triggered_at: string | null;
|
|
91
|
-
acknowledged_at: string | null;
|
|
92
|
-
requires_approval: number;
|
|
93
|
-
action_summary: string | null;
|
|
94
|
-
action_data: string | null;
|
|
95
|
-
priority: TaskPriority;
|
|
96
|
-
tags: string | null;
|
|
97
|
-
recurrence: EventRecurrence | null;
|
|
98
|
-
}
|
|
99
|
-
export type ChangeType = "created" | "modified" | "deleted" | "refactored" | "renamed" | "moved" | "config_changed";
|
|
100
|
-
export type ImpactScope = "local" | "module" | "cross_module" | "global";
|
|
101
|
-
export type DecisionStatus = "active" | "superseded" | "deprecated" | "experimental";
|
|
102
|
-
export type ArchLayer = "ui" | "viewmodel" | "domain" | "data" | "network" | "database" | "di" | "util" | "test" | "config" | "build" | "other";
|
|
103
|
-
export type Complexity = "trivial" | "simple" | "moderate" | "complex" | "critical";
|
|
104
|
-
export type ConventionCategory = "naming" | "architecture" | "styling" | "testing" | "git" | "documentation" | "error_handling" | "performance" | "security" | "other";
|
|
105
|
-
export type TaskStatus = "backlog" | "in_progress" | "blocked" | "review" | "done" | "cancelled";
|
|
106
|
-
export type TaskPriority = "critical" | "high" | "medium" | "low";
|
|
107
|
-
export type EventTriggerType = "next_session" | "datetime" | "task_complete" | "manual";
|
|
108
|
-
export type EventStatus = "pending" | "triggered" | "acknowledged" | "executed" | "cancelled" | "snoozed";
|
|
109
|
-
export type EventRecurrence = "once" | "every_session" | "daily" | "weekly";
|
|
110
|
-
export interface SessionContext {
|
|
111
|
-
session_id: number;
|
|
112
|
-
previous_session: {
|
|
113
|
-
id: number;
|
|
114
|
-
summary: string | null;
|
|
115
|
-
ended_at: string | null;
|
|
116
|
-
agent: string;
|
|
117
|
-
} | null;
|
|
118
|
-
changes_since_last: {
|
|
119
|
-
recorded: ChangeRow[];
|
|
120
|
-
git_log: string;
|
|
121
|
-
};
|
|
122
|
-
active_decisions: DecisionRow[];
|
|
123
|
-
active_conventions: ConventionRow[];
|
|
124
|
-
open_tasks: TaskRow[];
|
|
125
|
-
project_snapshot_age_minutes: number | null;
|
|
126
|
-
message: string;
|
|
127
|
-
}
|
|
128
|
-
export interface ProjectSnapshot {
|
|
129
|
-
project_root: string;
|
|
130
|
-
file_tree: string[];
|
|
131
|
-
total_files: number;
|
|
132
|
-
file_notes: FileNoteRow[];
|
|
133
|
-
recent_decisions: DecisionRow[];
|
|
134
|
-
active_conventions: ConventionRow[];
|
|
135
|
-
layer_distribution: Record<string, number>;
|
|
136
|
-
generated_at: string;
|
|
137
|
-
}
|
|
138
|
-
export interface MemoryStats {
|
|
139
|
-
total_sessions: number;
|
|
140
|
-
total_changes: number;
|
|
141
|
-
total_decisions: number;
|
|
142
|
-
total_file_notes: number;
|
|
143
|
-
total_conventions: number;
|
|
144
|
-
total_tasks: number;
|
|
145
|
-
total_milestones: number;
|
|
146
|
-
oldest_session: string | null;
|
|
147
|
-
newest_session: string | null;
|
|
148
|
-
most_changed_files: Array<{
|
|
149
|
-
file_path: string;
|
|
150
|
-
change_count: number;
|
|
151
|
-
}>;
|
|
152
|
-
database_size_kb: number;
|
|
153
|
-
}
|
|
154
|
-
export interface CompactionResult {
|
|
155
|
-
sessions_compacted: number;
|
|
156
|
-
changes_summarized: number;
|
|
157
|
-
storage_freed_kb: number;
|
|
158
|
-
}
|
|
159
|
-
export interface ConfigRow {
|
|
160
|
-
key: string;
|
|
161
|
-
value: string;
|
|
162
|
-
updated_at: string;
|
|
163
|
-
}
|
|
164
|
-
export interface BackupInfo {
|
|
165
|
-
path: string;
|
|
166
|
-
size_kb: number;
|
|
167
|
-
created_at: string;
|
|
168
|
-
database_version: number;
|
|
169
|
-
}
|
|
170
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,UAAU,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,WAAW,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,GAAG,IAAI,CAA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M,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
package/dist/src/types.js
DELETED
package/dist/src/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,uCAAuC;AACvC,+EAA+E"}
|
package/dist/src/utils.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { ArchLayer } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Auto-detect the project root by walking up from cwd looking for marker files.
|
|
4
|
-
*/
|
|
5
|
-
export declare function findProjectRoot(startDir?: string): string;
|
|
6
|
-
/**
|
|
7
|
-
* Scan the project file tree, respecting exclusions and depth limits.
|
|
8
|
-
*/
|
|
9
|
-
export declare function scanFileTree(rootDir: string, maxDepth?: number, maxEntries?: number): string[];
|
|
10
|
-
/**
|
|
11
|
-
* Detect the architectural layer of a file based on its path.
|
|
12
|
-
*/
|
|
13
|
-
export declare function detectLayer(filePath: string): ArchLayer;
|
|
14
|
-
/**
|
|
15
|
-
* Run a git command in the project root. Returns empty string on failure.
|
|
16
|
-
*/
|
|
17
|
-
export declare function gitCommand(projectRoot: string, command: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Check if the project is a git repository.
|
|
20
|
-
*/
|
|
21
|
-
export declare function isGitRepo(projectRoot: string): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Get git log since a given timestamp.
|
|
24
|
-
*/
|
|
25
|
-
export declare function getGitLogSince(projectRoot: string, since: string, limit?: number): string;
|
|
26
|
-
/**
|
|
27
|
-
* Get git diff stat (files changed, insertions, deletions).
|
|
28
|
-
*/
|
|
29
|
-
export declare function getGitDiffStat(projectRoot: string, since: string): string;
|
|
30
|
-
/**
|
|
31
|
-
* Get files changed in git since a timestamp.
|
|
32
|
-
*/
|
|
33
|
-
export declare function getGitFilesChanged(projectRoot: string, since: string): string[];
|
|
34
|
-
/**
|
|
35
|
-
* Get the current git branch name.
|
|
36
|
-
*/
|
|
37
|
-
export declare function getGitBranch(projectRoot: string): string;
|
|
38
|
-
/**
|
|
39
|
-
* Get the latest git commit hash (short).
|
|
40
|
-
*/
|
|
41
|
-
export declare function getGitHead(projectRoot: string): string;
|
|
42
|
-
/**
|
|
43
|
-
* Safely parse a JSON string, returning a default value on failure.
|
|
44
|
-
*/
|
|
45
|
-
export declare function safeJsonParse<T>(json: string | null | undefined, fallback: T): T;
|
|
46
|
-
/**
|
|
47
|
-
* Format a response as either JSON or Markdown.
|
|
48
|
-
*/
|
|
49
|
-
export declare function formatResponse(data: unknown, format?: "json" | "markdown"): string;
|
|
50
|
-
/**
|
|
51
|
-
* Calculate minutes between now and a given ISO timestamp.
|
|
52
|
-
*/
|
|
53
|
-
export declare function minutesSince(isoTimestamp: string): number;
|
|
54
|
-
/**
|
|
55
|
-
* Truncate a string to a max length with ellipsis.
|
|
56
|
-
*/
|
|
57
|
-
export declare function truncate(str: string, maxLength: number): string;
|
|
58
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/src/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;GAE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M,GAAG,MAAM,CAIzD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG/D"}
|
package/dist/src/utils.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// Engram MCP Server — Utilities
|
|
3
|
-
// ============================================================================
|
|
4
|
-
import { execSync } from "child_process";
|
|
5
|
-
import * as fs from "fs";
|
|
6
|
-
import * as path from "path";
|
|
7
|
-
import { EXCLUDED_DIRS, LAYER_PATTERNS, MAX_FILE_TREE_DEPTH, MAX_FILE_TREE_ENTRIES, PROJECT_MARKERS, } from "./constants.js";
|
|
8
|
-
/**
|
|
9
|
-
* Auto-detect the project root by walking up from cwd looking for marker files.
|
|
10
|
-
*/
|
|
11
|
-
export function findProjectRoot(startDir) {
|
|
12
|
-
// 1. Explicit env var
|
|
13
|
-
if (process.env.ENGRAM_PROJECT_ROOT)
|
|
14
|
-
return process.env.ENGRAM_PROJECT_ROOT;
|
|
15
|
-
if (process.env.PROJECT_ROOT)
|
|
16
|
-
return process.env.PROJECT_ROOT;
|
|
17
|
-
// 2. Walk up directory tree
|
|
18
|
-
let dir = startDir || process.cwd();
|
|
19
|
-
while (dir !== path.dirname(dir)) {
|
|
20
|
-
for (const marker of PROJECT_MARKERS) {
|
|
21
|
-
if (fs.existsSync(path.join(dir, marker))) {
|
|
22
|
-
return dir;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
dir = path.dirname(dir);
|
|
26
|
-
}
|
|
27
|
-
// 3. Fallback to cwd
|
|
28
|
-
return process.cwd();
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Scan the project file tree, respecting exclusions and depth limits.
|
|
32
|
-
*/
|
|
33
|
-
export function scanFileTree(rootDir, maxDepth = MAX_FILE_TREE_DEPTH, maxEntries = MAX_FILE_TREE_ENTRIES) {
|
|
34
|
-
const files = [];
|
|
35
|
-
// Merge .engramignore entries with the default exclusion set
|
|
36
|
-
const exclusions = new Set(EXCLUDED_DIRS);
|
|
37
|
-
try {
|
|
38
|
-
const ignorePath = path.join(rootDir, ".engramignore");
|
|
39
|
-
if (fs.existsSync(ignorePath)) {
|
|
40
|
-
const lines = fs.readFileSync(ignorePath, "utf-8").split("\n");
|
|
41
|
-
for (const line of lines) {
|
|
42
|
-
const trimmed = line.trim();
|
|
43
|
-
if (trimmed && !trimmed.startsWith("#")) {
|
|
44
|
-
exclusions.add(trimmed.replace(/\/$/, "")); // Strip trailing slash
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch { /* .engramignore is optional */ }
|
|
50
|
-
function walk(dir, depth) {
|
|
51
|
-
if (depth > maxDepth || files.length >= maxEntries)
|
|
52
|
-
return;
|
|
53
|
-
let entries;
|
|
54
|
-
try {
|
|
55
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
// Sort for deterministic output
|
|
61
|
-
entries.sort((a, b) => a.name.localeCompare(b.name));
|
|
62
|
-
for (const entry of entries) {
|
|
63
|
-
if (files.length >= maxEntries)
|
|
64
|
-
break;
|
|
65
|
-
if (entry.name.startsWith(".") && entry.isDirectory())
|
|
66
|
-
continue;
|
|
67
|
-
if (entry.isDirectory()) {
|
|
68
|
-
if (exclusions.has(entry.name))
|
|
69
|
-
continue;
|
|
70
|
-
const subPath = path.relative(rootDir, path.join(dir, entry.name));
|
|
71
|
-
files.push(subPath + "/");
|
|
72
|
-
walk(path.join(dir, entry.name), depth + 1);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
const relPath = path.relative(rootDir, path.join(dir, entry.name));
|
|
76
|
-
files.push(relPath);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
walk(rootDir, 0);
|
|
81
|
-
return files;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Detect the architectural layer of a file based on its path.
|
|
85
|
-
*/
|
|
86
|
-
export function detectLayer(filePath) {
|
|
87
|
-
const normalized = "/" + filePath.replace(/\\/g, "/");
|
|
88
|
-
for (const [layer, patterns] of Object.entries(LAYER_PATTERNS)) {
|
|
89
|
-
for (const pattern of patterns) {
|
|
90
|
-
if (pattern.test(normalized)) {
|
|
91
|
-
return layer;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return "other";
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Run a git command in the project root. Returns empty string on failure.
|
|
99
|
-
*/
|
|
100
|
-
export function gitCommand(projectRoot, command) {
|
|
101
|
-
try {
|
|
102
|
-
return execSync(`cd "${projectRoot}" && git ${command}`, {
|
|
103
|
-
encoding: "utf-8",
|
|
104
|
-
timeout: 10000,
|
|
105
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
106
|
-
}).trim();
|
|
107
|
-
}
|
|
108
|
-
catch {
|
|
109
|
-
return "";
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Check if the project is a git repository.
|
|
114
|
-
*/
|
|
115
|
-
export function isGitRepo(projectRoot) {
|
|
116
|
-
return fs.existsSync(path.join(projectRoot, ".git"));
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Get git log since a given timestamp.
|
|
120
|
-
*/
|
|
121
|
-
export function getGitLogSince(projectRoot, since, limit = 50) {
|
|
122
|
-
return gitCommand(projectRoot, `log --name-status --since="${since}" --pretty=format:"[%h] %s (%ar)" -${limit}`);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Get git diff stat (files changed, insertions, deletions).
|
|
126
|
-
*/
|
|
127
|
-
export function getGitDiffStat(projectRoot, since) {
|
|
128
|
-
return gitCommand(projectRoot, `diff --stat HEAD@{${since}} 2>/dev/null`);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Get files changed in git since a timestamp.
|
|
132
|
-
*/
|
|
133
|
-
export function getGitFilesChanged(projectRoot, since) {
|
|
134
|
-
const result = gitCommand(projectRoot, `log --name-only --since="${since}" --pretty=format:"" 2>/dev/null`);
|
|
135
|
-
if (!result)
|
|
136
|
-
return [];
|
|
137
|
-
return [...new Set(result.split("\n").filter(Boolean))];
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Get the current git branch name.
|
|
141
|
-
*/
|
|
142
|
-
export function getGitBranch(projectRoot) {
|
|
143
|
-
return gitCommand(projectRoot, "rev-parse --abbrev-ref HEAD");
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Get the latest git commit hash (short).
|
|
147
|
-
*/
|
|
148
|
-
export function getGitHead(projectRoot) {
|
|
149
|
-
return gitCommand(projectRoot, "rev-parse --short HEAD");
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Safely parse a JSON string, returning a default value on failure.
|
|
153
|
-
*/
|
|
154
|
-
export function safeJsonParse(json, fallback) {
|
|
155
|
-
if (!json)
|
|
156
|
-
return fallback;
|
|
157
|
-
try {
|
|
158
|
-
return JSON.parse(json);
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return fallback;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Format a response as either JSON or Markdown.
|
|
166
|
-
*/
|
|
167
|
-
export function formatResponse(data, format = "json") {
|
|
168
|
-
if (format === "json") {
|
|
169
|
-
return JSON.stringify(data, null, 2);
|
|
170
|
-
}
|
|
171
|
-
// For markdown, we just pretty-print JSON in a code block
|
|
172
|
-
return "```json\n" + JSON.stringify(data, null, 2) + "\n```";
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Calculate minutes between now and a given ISO timestamp.
|
|
176
|
-
*/
|
|
177
|
-
export function minutesSince(isoTimestamp) {
|
|
178
|
-
const then = new Date(isoTimestamp).getTime();
|
|
179
|
-
const diff = Date.now() - then;
|
|
180
|
-
return Math.floor(diff / 60000);
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Truncate a string to a max length with ellipsis.
|
|
184
|
-
*/
|
|
185
|
-
export function truncate(str, maxLength) {
|
|
186
|
-
if (str.length <= maxLength)
|
|
187
|
-
return str;
|
|
188
|
-
return str.slice(0, maxLength - 3) + "...";
|
|
189
|
-
}
|
|
190
|
-
//# sourceMappingURL=utils.js.map
|