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
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Database as DatabaseType } from "better-sqlite3";
|
|
2
|
-
import type { ScheduledEventRow } from "../types.js";
|
|
3
|
-
export declare class EventsRepo {
|
|
4
|
-
private db;
|
|
5
|
-
constructor(db: DatabaseType);
|
|
6
|
-
create(sessionId: number | null, timestamp: string, data: {
|
|
7
|
-
title: string;
|
|
8
|
-
description?: string | null;
|
|
9
|
-
trigger_type: string;
|
|
10
|
-
trigger_value?: string | null;
|
|
11
|
-
requires_approval?: boolean;
|
|
12
|
-
action_summary?: string | null;
|
|
13
|
-
action_data?: string | null;
|
|
14
|
-
priority?: string;
|
|
15
|
-
tags?: string[] | null;
|
|
16
|
-
recurrence?: string | null;
|
|
17
|
-
}): number;
|
|
18
|
-
triggerNextSession(timestamp: string): void;
|
|
19
|
-
triggerExpiredDatetime(timestamp: string): void;
|
|
20
|
-
triggerEverySession(timestamp: string): void;
|
|
21
|
-
triggerTaskComplete(taskId: number, timestamp: string): void;
|
|
22
|
-
getTriggered(): ScheduledEventRow[];
|
|
23
|
-
getFiltered(filters: {
|
|
24
|
-
status?: string;
|
|
25
|
-
trigger_type?: string;
|
|
26
|
-
tag?: string;
|
|
27
|
-
include_past?: boolean;
|
|
28
|
-
limit: number;
|
|
29
|
-
}): ScheduledEventRow[];
|
|
30
|
-
getById(id: number): ScheduledEventRow | null;
|
|
31
|
-
updateStatus(id: number, status: string, extraFields?: Record<string, unknown>): number;
|
|
32
|
-
acknowledge(id: number, timestamp: string): number;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=events.repo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.repo.d.ts","sourceRoot":"","sources":["../../../src/repositories/events.repo.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D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,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAiBvF,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;CAKrD"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// Engram MCP Server — Scheduled Events Repository
|
|
3
|
-
// ============================================================================
|
|
4
|
-
export class EventsRepo {
|
|
5
|
-
db;
|
|
6
|
-
constructor(db) {
|
|
7
|
-
this.db = db;
|
|
8
|
-
}
|
|
9
|
-
create(sessionId, timestamp, data) {
|
|
10
|
-
const result = this.db.prepare(`INSERT INTO scheduled_events (session_id, created_at, title, description, trigger_type, trigger_value,
|
|
11
|
-
status, requires_approval, action_summary, action_data, priority, tags, recurrence)
|
|
12
|
-
VALUES (?, ?, ?, ?, ?, ?, 'pending', ?, ?, ?, ?, ?, ?)`).run(sessionId, timestamp, data.title, data.description || null, data.trigger_type, data.trigger_value || null, data.requires_approval !== false ? 1 : 0, data.action_summary || null, data.action_data || null, data.priority || "medium", data.tags ? JSON.stringify(data.tags) : null, data.recurrence || "once");
|
|
13
|
-
return result.lastInsertRowid;
|
|
14
|
-
}
|
|
15
|
-
triggerNextSession(timestamp) {
|
|
16
|
-
this.db.prepare("UPDATE scheduled_events SET status = 'triggered', triggered_at = ? WHERE status = 'pending' AND trigger_type = 'next_session'").run(timestamp);
|
|
17
|
-
}
|
|
18
|
-
triggerExpiredDatetime(timestamp) {
|
|
19
|
-
this.db.prepare("UPDATE scheduled_events SET status = 'triggered', triggered_at = ? WHERE status = 'pending' AND trigger_type = 'datetime' AND trigger_value <= ?").run(timestamp, timestamp);
|
|
20
|
-
}
|
|
21
|
-
triggerEverySession(timestamp) {
|
|
22
|
-
this.db.prepare("UPDATE scheduled_events SET status = 'triggered', triggered_at = ? WHERE status = 'pending' AND recurrence = 'every_session'").run(timestamp);
|
|
23
|
-
}
|
|
24
|
-
triggerTaskComplete(taskId, timestamp) {
|
|
25
|
-
this.db.prepare("UPDATE scheduled_events SET status = 'triggered', triggered_at = ? WHERE status = 'pending' AND trigger_type = 'task_complete' AND trigger_value = ?").run(timestamp, String(taskId));
|
|
26
|
-
}
|
|
27
|
-
getTriggered() {
|
|
28
|
-
return this.db.prepare("SELECT * FROM scheduled_events WHERE status = 'triggered' ORDER BY CASE priority WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END").all();
|
|
29
|
-
}
|
|
30
|
-
getFiltered(filters) {
|
|
31
|
-
let query = "SELECT * FROM scheduled_events WHERE 1=1";
|
|
32
|
-
const params = [];
|
|
33
|
-
if (filters.status) {
|
|
34
|
-
query += " AND status = ?";
|
|
35
|
-
params.push(filters.status);
|
|
36
|
-
}
|
|
37
|
-
if (filters.trigger_type) {
|
|
38
|
-
query += " AND trigger_type = ?";
|
|
39
|
-
params.push(filters.trigger_type);
|
|
40
|
-
}
|
|
41
|
-
if (filters.tag) {
|
|
42
|
-
query += " AND EXISTS (SELECT 1 FROM json_each(tags) WHERE value = ?)";
|
|
43
|
-
params.push(filters.tag);
|
|
44
|
-
}
|
|
45
|
-
if (!filters.include_past) {
|
|
46
|
-
query += " AND status NOT IN ('executed', 'cancelled')";
|
|
47
|
-
}
|
|
48
|
-
query += " ORDER BY created_at DESC LIMIT ?";
|
|
49
|
-
params.push(filters.limit);
|
|
50
|
-
return this.db.prepare(query).all(...params);
|
|
51
|
-
}
|
|
52
|
-
getById(id) {
|
|
53
|
-
return this.db.prepare("SELECT * FROM scheduled_events WHERE id = ?").get(id) ?? null;
|
|
54
|
-
}
|
|
55
|
-
updateStatus(id, status, extraFields) {
|
|
56
|
-
const sets = ["status = ?"];
|
|
57
|
-
const params = [status];
|
|
58
|
-
if (extraFields) {
|
|
59
|
-
for (const [key, value] of Object.entries(extraFields)) {
|
|
60
|
-
sets.push(`${key} = ?`);
|
|
61
|
-
params.push(value);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
params.push(id);
|
|
65
|
-
return this.db.prepare(`UPDATE scheduled_events SET ${sets.join(", ")} WHERE id = ?`).run(...params).changes;
|
|
66
|
-
}
|
|
67
|
-
acknowledge(id, timestamp) {
|
|
68
|
-
return this.db.prepare("UPDATE scheduled_events SET status = 'acknowledged', acknowledged_at = ? WHERE id = ?").run(timestamp, id).changes;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=events.repo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.repo.js","sourceRoot":"","sources":["../../../src/repositories/events.repo.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,kDAAkD;AAClD,+EAA+E;AAK/E,MAAM,OAAO,UAAU;IACC;IAApB,YAAoB,EAAgB;QAAhB,OAAE,GAAF,EAAE,CAAc;IAAI,CAAC;IAEzC,MAAM,CACF,SAAwB,EACxB,SAAiB,EACjB,IAWC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAC1B;;8DAEkD,CACrD,CAAC,GAAG,CACD,SAAS,EAAE,SAAS,EACpB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI,EACpC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI,EAC7C,IAAI,CAAC,iBAAiB,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACxC,IAAI,CAAC,cAAc,IAAI,IAAI,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI,EACrD,IAAI,CAAC,QAAQ,IAAI,QAAQ,EACzB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAC5C,IAAI,CAAC,UAAU,IAAI,MA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AuF,CAC1F,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC;IACjC,CAAC;CACJ"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Database as DatabaseType } from "better-sqlite3";
|
|
2
|
-
import type { FileNoteRow } from "../types.js";
|
|
3
|
-
export declare class FileNotesRepo {
|
|
4
|
-
private db;
|
|
5
|
-
constructor(db: DatabaseType);
|
|
6
|
-
upsert(filePath: string, timestamp: string, sessionId: number | null, data: {
|
|
7
|
-
purpose?: string | null;
|
|
8
|
-
dependencies?: string[] | null;
|
|
9
|
-
dependents?: string[] | null;
|
|
10
|
-
layer?: string | null;
|
|
11
|
-
complexity?: string | null;
|
|
12
|
-
notes?: string | null;
|
|
13
|
-
}): void;
|
|
14
|
-
getByPath(filePath: string): FileNoteRow | null;
|
|
15
|
-
getFiltered(filters: {
|
|
16
|
-
layer?: string;
|
|
17
|
-
complexity?: string;
|
|
18
|
-
}): FileNoteRow[];
|
|
19
|
-
getAll(): FileNoteRow[];
|
|
20
|
-
countAll(): number;
|
|
21
|
-
getLayerDistribution(): Array<{
|
|
22
|
-
layer: string;
|
|
23
|
-
count: number;
|
|
24
|
-
}>;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=file-notes.repo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-notes.repo.d.ts","sourceRoot":"","sources":["../../../src/repositories/file-notes.repo.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,qBAAa,aAAa;IACV,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,YAAY;IAEpC,MAAM,CACF,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,IAAI,EAAE;QACF,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAC/B,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,GACF,IAAI;IA4BP,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI;IAM/C,WAAW,CAAC,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,WAAW,EAAE;IAW5E,MAAM,IAAI,WAAW,EAAE;IAIvB,QAAQ,IAAI,MAAM;IAIlB,oBAAoB,IAAI,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAKlE"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// Engram MCP Server — File Notes Repository
|
|
3
|
-
// ============================================================================
|
|
4
|
-
export class FileNotesRepo {
|
|
5
|
-
db;
|
|
6
|
-
constructor(db) {
|
|
7
|
-
this.db = db;
|
|
8
|
-
}
|
|
9
|
-
upsert(filePath, timestamp, sessionId, data) {
|
|
10
|
-
const deps = data.dependencies ? JSON.stringify(data.dependencies) : null;
|
|
11
|
-
const depnts = data.dependents ? JSON.stringify(data.dependents) : null;
|
|
12
|
-
this.db.prepare(`
|
|
13
|
-
INSERT INTO file_notes (file_path, purpose, dependencies, dependents, layer, last_reviewed, last_modified_session, notes, complexity)
|
|
14
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
15
|
-
ON CONFLICT(file_path) DO UPDATE SET
|
|
16
|
-
purpose = COALESCE(?, purpose),
|
|
17
|
-
dependencies = COALESCE(?, dependencies),
|
|
18
|
-
dependents = COALESCE(?, dependents),
|
|
19
|
-
layer = COALESCE(?, layer),
|
|
20
|
-
last_reviewed = ?,
|
|
21
|
-
last_modified_session = COALESCE(?, last_modified_session),
|
|
22
|
-
notes = COALESCE(?, notes),
|
|
23
|
-
complexity = COALESCE(?, complexity)
|
|
24
|
-
`).run(filePath, data.purpose || null, deps, depnts, data.layer || null, timestamp, sessionId, data.notes || null, data.complexity || null,
|
|
25
|
-
// Update values
|
|
26
|
-
data.purpose || null, deps, depnts, data.layer || null, timestamp, sessionId, data.notes || null, data.complexity || null);
|
|
27
|
-
}
|
|
28
|
-
getByPath(filePath) {
|
|
29
|
-
return this.db.prepare("SELECT * FROM file_notes WHERE file_path = ?").get(filePath) ?? null;
|
|
30
|
-
}
|
|
31
|
-
getFiltered(filters) {
|
|
32
|
-
let query = "SELECT * FROM file_notes WHERE 1=1";
|
|
33
|
-
const params = [];
|
|
34
|
-
if (filters.layer) {
|
|
35
|
-
query += " AND layer = ?";
|
|
36
|
-
params.push(filters.layer);
|
|
37
|
-
}
|
|
38
|
-
if (filters.complexity) {
|
|
39
|
-
query += " AND complexity = ?";
|
|
40
|
-
params.push(filters.complexity);
|
|
41
|
-
}
|
|
42
|
-
query += " ORDER BY file_path";
|
|
43
|
-
return this.db.prepare(query).all(...params);
|
|
44
|
-
}
|
|
45
|
-
getAll() {
|
|
46
|
-
return this.db.prepare("SELECT * FROM file_notes ORDER BY file_path").all();
|
|
47
|
-
}
|
|
48
|
-
countAll() {
|
|
49
|
-
return this.db.prepare("SELECT COUNT(*) as c FROM file_notes").get().c;
|
|
50
|
-
}
|
|
51
|
-
getLayerDistribution() {
|
|
52
|
-
return this.db.prepare("SELECT layer, COUNT(*) as count FROM file_notes WHERE layer IS NOT NULL GROUP BY layer ORDER BY count DESC").all();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=file-notes.rep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AA6B,IAAI,IAAI,CAAC;IACxD,CAAC;IAED,WAAW,CAAC,OAAgD;QACxD,IAAI,KAAK,GAAG,oCAAoC,CAAC;QACjD,MAAM,MAAM,GAAc,EAAE,CAAC;QAE7B,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAAC,KAAK,IAAI,gBAAgB,CAAC;YAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAAC,CAAC;QAC7E,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YAAC,KAAK,IAAI,qBAAqB,CAAC;YAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAAC,CAAC;QAC5F,KAAK,IAAI,qBAAqB,CAAC;QAE/B,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,MAAM,CAAkB,CAAC;IAClE,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,6CAA6C,CAAC,CAAC,GAAG,EAAmB,CAAC;IACjG,CAAC;IAED,QAAQ;QACJ,OAAQ,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC,GAAG,EAAoB,CAAC,CAAC,CAAC;IAC9F,CAAC;IAED,oBAAoB;QAChB,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAClB,4GAA4G,CAC/G,CAAC,GAAG,EAA6C,CAAC;IACvD,CAAC;CACJ"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export { SessionsRepo } from "./sessions.repo.js";
|
|
2
|
-
export { ChangesRepo } from "./changes.repo.js";
|
|
3
|
-
export { DecisionsRepo } from "./decisions.repo.js";
|
|
4
|
-
export { FileNotesRepo } from "./file-notes.repo.js";
|
|
5
|
-
export { ConventionsRepo } from "./conventions.repo.js";
|
|
6
|
-
export { TasksRepo } from "./tasks.repo.js";
|
|
7
|
-
export { MilestonesRepo } from "./milestones.repo.js";
|
|
8
|
-
export { EventsRepo } from "./events.repo.js";
|
|
9
|
-
export { ConfigRepo } from "./config.repo.js";
|
|
10
|
-
export { SnapshotRepo } from "./snapshot.repo.js";
|
|
11
|
-
import type { Database as DatabaseType } from "better-sqlite3";
|
|
12
|
-
import { SessionsRepo } from "./sessions.repo.js";
|
|
13
|
-
import { ChangesRepo } from "./changes.repo.js";
|
|
14
|
-
import { DecisionsRepo } from "./decisions.repo.js";
|
|
15
|
-
import { FileNotesRepo } from "./file-notes.repo.js";
|
|
16
|
-
import { ConventionsRepo } from "./conventions.repo.js";
|
|
17
|
-
import { TasksRepo } from "./tasks.repo.js";
|
|
18
|
-
import { MilestonesRepo } from "./milestones.repo.js";
|
|
19
|
-
import { EventsRepo } from "./events.repo.js";
|
|
20
|
-
import { ConfigRepo } from "./config.repo.js";
|
|
21
|
-
import { SnapshotRepo } from "./snapshot.repo.js";
|
|
22
|
-
export interface Repositories {
|
|
23
|
-
sessions: SessionsRepo;
|
|
24
|
-
changes: ChangesRepo;
|
|
25
|
-
decisions: DecisionsRepo;
|
|
26
|
-
fileNotes: FileNotesRepo;
|
|
27
|
-
conventions: ConventionsRepo;
|
|
28
|
-
tasks: TasksRepo;
|
|
29
|
-
milestones: MilestonesRepo;
|
|
30
|
-
events: EventsRepo;
|
|
31
|
-
config: ConfigRepo;
|
|
32
|
-
snapshot: SnapshotRepo;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Create all repository instances from a single database connection.
|
|
36
|
-
*/
|
|
37
|
-
export declare function createRepositories(db: DatabaseType): Repositories;
|
|
38
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repositories/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA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AM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,YAAY,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,YAAY,GAAG,YAAY,CAajE"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// Engram MCP Server — Repository Barrel Export
|
|
3
|
-
// ============================================================================
|
|
4
|
-
export { SessionsRepo } from "./sessions.repo.js";
|
|
5
|
-
export { ChangesRepo } from "./changes.repo.js";
|
|
6
|
-
export { DecisionsRepo } from "./decisions.repo.js";
|
|
7
|
-
export { FileNotesRepo } from "./file-notes.repo.js";
|
|
8
|
-
export { ConventionsRepo } from "./conventions.repo.js";
|
|
9
|
-
export { TasksRepo } from "./tasks.repo.js";
|
|
10
|
-
export { MilestonesRepo } from "./milestones.repo.js";
|
|
11
|
-
export { EventsRepo } from "./events.repo.js";
|
|
12
|
-
export { ConfigRepo } from "./config.repo.js";
|
|
13
|
-
export { SnapshotRepo } from "./snapshot.repo.js";
|
|
14
|
-
import { SessionsRepo } from "./sessions.repo.js";
|
|
15
|
-
import { ChangesRepo } from "./changes.repo.js";
|
|
16
|
-
import { DecisionsRepo } from "./decisions.repo.js";
|
|
17
|
-
import { FileNotesRepo } from "./file-notes.repo.js";
|
|
18
|
-
import { ConventionsRepo } from "./conventions.repo.js";
|
|
19
|
-
import { TasksRepo } from "./tasks.repo.js";
|
|
20
|
-
import { MilestonesRepo } from "./milestones.repo.js";
|
|
21
|
-
import { EventsRepo } from "./events.repo.js";
|
|
22
|
-
import { ConfigRepo } from "./config.repo.js";
|
|
23
|
-
import { SnapshotRepo } from "./snapshot.repo.js";
|
|
24
|
-
/**
|
|
25
|
-
* Create all repository instances from a single database connection.
|
|
26
|
-
*/
|
|
27
|
-
export function createRepositories(db) {
|
|
28
|
-
return {
|
|
29
|
-
sessions: new SessionsRepo(db),
|
|
30
|
-
changes: new ChangesRepo(db),
|
|
31
|
-
decisions: new DecisionsRepo(db),
|
|
32
|
-
fileNotes: new FileNotesRepo(db),
|
|
33
|
-
conventions: new ConventionsRepo(db),
|
|
34
|
-
tasks: new TasksRepo(db),
|
|
35
|
-
milestones: new MilestonesRepo(db),
|
|
36
|
-
events: new EventsRepo(db),
|
|
37
|
-
config: new ConfigRepo(db),
|
|
38
|
-
snapshot: new SnapshotRepo(db),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+CAA+C;AAC/C,+EAA+E;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAelD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,EAAgB;IAC/C,OAAO;QACH,QAAQ,EAAE,IAAI,YAAY,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,IAAI,WAAW,CAAC,EAAE,CAAC;QAC5B,SAAS,EAAE,IAAI,aAAa,CAAC,EAAE,CAAC;QAChC,SAAS,EAAE,IAAI,aAAa,CAAC,EAAE,CAAC;QAChC,WAAW,EAAE,IAAI,eAAe,CAAC,EAAE,CAAC;QACpC,KAAK,EAAE,IAAI,SAAS,CAAC,EAAE,CAAC;QACxB,UAAU,EAAE,IAAI,cAAc,CAAC,EAAE,CAAC;QAClC,MAAM,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC;QAC1B,MAAM,EAAE,IAAI,UAAU,CAAC,EAAE,CAAC;QAC1B,QAAQ,EAAE,IAAI,YAAY,CAAC,EAAE,CAAC;KACjC,CAAC;AACN,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Database as DatabaseType } from "better-sqlite3";
|
|
2
|
-
import type { MilestoneRow } from "../types.js";
|
|
3
|
-
export declare class MilestonesRepo {
|
|
4
|
-
private db;
|
|
5
|
-
constructor(db: DatabaseType);
|
|
6
|
-
create(sessionId: number | null, timestamp: string, title: string, description?: string | null, version?: string | null, tags?: string[] | null): number;
|
|
7
|
-
getAll(limit: number): MilestoneRow[];
|
|
8
|
-
countAll(): number;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=milestones.repo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"milestones.repo.d.ts","sourceRoot":"","sources":["../../../src/repositories/milestones.repo.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,qBAAa,cAAc;IACX,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,YAAY;IAEpC,MAAM,CACF,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,EAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EACvB,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,GACvB,MAAM;IAOT,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE;IAMrC,QAAQ,IAAI,MAAM;CAGrB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// Engram MCP Server — Milestones Repository
|
|
3
|
-
// ============================================================================
|
|
4
|
-
export class MilestonesRepo {
|
|
5
|
-
db;
|
|
6
|
-
constructor(db) {
|
|
7
|
-
this.db = db;
|
|
8
|
-
}
|
|
9
|
-
create(sessionId, timestamp, title, description, version, tags) {
|
|
10
|
-
const result = this.db.prepare("INSERT INTO milestones (session_id, timestamp, title, description, version, tags) VALUES (?, ?, ?, ?, ?, ?)").run(sessionId, timestamp, title, description || null, version || null, tags ? JSON.stringify(tags) : null);
|
|
11
|
-
return result.lastInsertRowid;
|
|
12
|
-
}
|
|
13
|
-
getAll(limit) {
|
|
14
|
-
return this.db.prepare("SELECT * FROM milestones ORDER BY timestamp DESC LIMIT ?").all(limit);
|
|
15
|
-
}
|
|
16
|
-
countAll() {
|
|
17
|
-
return this.db.prepare("SELECT COUNT(*) as c FROM milestones").get().c;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=milestones.repo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"milestones.repo.js","sourceRoot":"","sources":["../../../src/repositories/milestones.repo.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,4CAA4C;AAC5C,+EAA+E;AAK/E,MAAM,OAAO,cAAc;IACH;IAApB,YAAoB,EAAgB;QAAhB,OAAE,GAAF,EAAE,CAAc;IAAI,CAAC;IAEzC,MAAM,CACF,SAAwB,EACxB,SAAiB,EACjB,KAAa,EACb,WAA2B,EAC3B,OAAuB,EACvB,IAAsB;QAEtB,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAC1B,6GAA6G,CAChH,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,IAAI,IAAI,EAAE,OAAO,IAAI,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7G,OAAO,MAAM,CAAC,eAAyB,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,KAAa;QAChB,OAAO,IAAI,CAAC,EAAE,CAAC,OAAO,CAClB,0DAA0D,CAC7D,CAAC,GAAG,CAAC,KAAK,CAAmB,CAAC;IACnC,CAAC;IAED,QAAQ;QACJ,OAAQ,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC,GAAG,EAAoB,CAAC,CAAC,CAAC;IAC9F,CAAC;CACJ"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Database as DatabaseType } from "better-sqlite3";
|
|
2
|
-
import type { SessionRow } from "../types.js";
|
|
3
|
-
export declare class SessionsRepo {
|
|
4
|
-
private db;
|
|
5
|
-
constructor(db: DatabaseType);
|
|
6
|
-
create(agentName: string, projectRoot: string, timestamp: string): number;
|
|
7
|
-
close(id: number, timestamp: string, summary: string, tags?: string[]): void;
|
|
8
|
-
autoClose(id: number, timestamp: string): void;
|
|
9
|
-
getOpenSessionId(): number | null;
|
|
10
|
-
getLastCompleted(): {
|
|
11
|
-
id: number;
|
|
12
|
-
ended_at: string;
|
|
13
|
-
summary: string | null;
|
|
14
|
-
agent_name: string;
|
|
15
|
-
} | null;
|
|
16
|
-
getHistory(limit: number, offset: number, agentName?: string): SessionRow[];
|
|
17
|
-
countAll(): number;
|
|
18
|
-
countCompleted(): number;
|
|
19
|
-
getOldest(): string | null;
|
|
20
|
-
getNewest(): string | null;
|
|
21
|
-
/** Get the ID at a given offset position (used for compaction cutoff). */
|
|
22
|
-
getIdAtOffset(offset: number): number | null;
|
|
23
|
-
/** Get IDs of completed sessions at or before a given ID. */
|
|
24
|
-
getCompletedBeforeId(cutoffId: number): number[];
|
|
25
|
-
countBySession(sessionId: number, table: string): number;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=sessions.repo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.repo.d.ts","sourceRoot":"","sources":["../../../src/repositories/sessions.repo.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,qBAAa,YAAY;IACT,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,YAAY;IAEpC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAOzE,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI;IAM5E,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAM9C,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAOjC,gBAAgB,IAAI;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAOvG,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE;IAW3E,QAAQ,IAAI,MAAM;IAIlB,cAAc,IAAI,MAAM;IAMxB,SAAS,IAAI,MAAM,GAAG,IAAI;IAO1B,SAAS,IAAI,MAAM,GAAG,IAAI;IAO1B,0EAA0E;IAC1E,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAO5C,6DAA6D;IAC7D,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAOhD,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CAK3D"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// Engram MCP Server — Sessions Repository
|
|
3
|
-
// ============================================================================
|
|
4
|
-
export class SessionsRepo {
|
|
5
|
-
db;
|
|
6
|
-
constructor(db) {
|
|
7
|
-
this.db = db;
|
|
8
|
-
}
|
|
9
|
-
create(agentName, projectRoot, timestamp) {
|
|
10
|
-
const result = this.db.prepare("INSERT INTO sessions (started_at, agent_name, project_root) VALUES (?, ?, ?)").run(timestamp, agentName, projectRoot);
|
|
11
|
-
return result.lastInsertRowid;
|
|
12
|
-
}
|
|
13
|
-
close(id, timestamp, summary, tags) {
|
|
14
|
-
this.db.prepare("UPDATE sessions SET ended_at = ?, summary = ?, tags = ? WHERE id = ?").run(timestamp, summary, tags ? JSON.stringify(tags) : null, id);
|
|
15
|
-
}
|
|
16
|
-
autoClose(id, timestamp) {
|
|
17
|
-
this.db.prepare("UPDATE sessions SET ended_at = ?, summary = ? WHERE id = ?").run(timestamp, "(auto-closed: new session started)", id);
|
|
18
|
-
}
|
|
19
|
-
getOpenSessionId() {
|
|
20
|
-
const row = this.db.prepare("SELECT id FROM sessions WHERE ended_at IS NULL ORDER BY id DESC LIMIT 1").get();
|
|
21
|
-
return row ? row.id : null;
|
|
22
|
-
}
|
|
23
|
-
getLastCompleted() {
|
|
24
|
-
const row = this.db.prepare("SELECT id, ended_at, summary, agent_name FROM sessions WHERE ended_at IS NOT NULL ORDER BY id DESC LIMIT 1").get();
|
|
25
|
-
return row ?? null;
|
|
26
|
-
}
|
|
27
|
-
getHistory(limit, offset, agentName) {
|
|
28
|
-
if (agentName) {
|
|
29
|
-
return this.db.prepare("SELECT * FROM sessions WHERE agent_name = ? ORDER BY id DESC LIMIT ? OFFSET ?").all(agentName, limit, offset);
|
|
30
|
-
}
|
|
31
|
-
return this.db.prepare("SELECT * FROM sessions ORDER BY id DESC LIMIT ? OFFSET ?").all(limit, offset);
|
|
32
|
-
}
|
|
33
|
-
countAll() {
|
|
34
|
-
return this.db.prepare("SELECT COUNT(*) as c FROM sessions").get().c;
|
|
35
|
-
}
|
|
36
|
-
countCompleted() {
|
|
37
|
-
return this.db.prepare("SELECT COUNT(*) as c FROM sessions WHERE ended_at IS NOT NULL").get().c;
|
|
38
|
-
}
|
|
39
|
-
getOldest() {
|
|
40
|
-
const row = this.db.prepare("SELECT started_at FROM sessions ORDER BY id ASC LIMIT 1").get();
|
|
41
|
-
return row?.started_at ?? null;
|
|
42
|
-
}
|
|
43
|
-
getNewest() {
|
|
44
|
-
const row = this.db.prepare("SELECT started_at FROM sessions ORDER BY id DESC LIMIT 1").get();
|
|
45
|
-
return row?.started_at ?? null;
|
|
46
|
-
}
|
|
47
|
-
/** Get the ID at a given offset position (used for compaction cutoff). */
|
|
48
|
-
getIdAtOffset(offset) {
|
|
49
|
-
const row = this.db.prepare("SELECT id FROM sessions ORDER BY id DESC LIMIT 1 OFFSET ?").get(offset);
|
|
50
|
-
return row?.id ?? null;
|
|
51
|
-
}
|
|
52
|
-
/** Get IDs of completed sessions at or before a given ID. */
|
|
53
|
-
getCompletedBeforeId(cutoffId) {
|
|
54
|
-
const rows = this.db.prepare("SELECT id FROM sessions WHERE id <= ? AND ended_at IS NOT NULL").all(cutoffId);
|
|
55
|
-
return rows.map(r => r.id);
|
|
56
|
-
}
|
|
57
|
-
countBySession(sessionId, table) {
|
|
58
|
-
return this.db.prepare(`SELECT COUNT(*) as c FROM ${table} WHERE session_id = ?`).get(sessionId).c;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=sessions.repo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.repo.js","sourceRoot":"","sources":["../../../src/repositories/sessions.repo.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,0CAA0C;AAC1C,+EAA+E;AAK/E,MAAM,OAAO,YAAY;IACD;IAApB,YAAoB,EAAgB;QAAhB,OAAE,GAAF,EAAE,CAAc;IAAI,CAAC;IAEzC,MAAM,CAAC,SAAiB,EAAE,WAAmB,EAAE,SAAiB;QAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAC1B,8EAA8E,CACjF,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;QACzC,OAAO,MAAM,CAAC,eAAyB,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,EAAU,EAAE,SAAiB,EAAE,OAAe,EAAE,IAAe;QACjE,IAAI,CAAC,EAAE,CAAC,OAAO,CACX,sEAAsE,CACzE,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,SAAS,CAAC,EAAU,EAAE,SAAiB;QACnC,IAAI,CAAC,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AC;IACnC,CAAC;IAED,SAAS;QACL,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CACvB,0DAA0D,CAC7D,CAAC,GAAG,EAAwC,CAAC;QAC9C,OAAO,GAAG,EAAE,UAAU,IAAI,IAAI,CAAC;IACnC,CAAC;IAED,0EAA0E;IAC1E,aAAa,CAAC,MAAc;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CACvB,2DAA2D,CAC9D,CAAC,GAAG,CAAC,MAAM,CAA+B,CAAC;QAC5C,OAAO,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC;IAC3B,CAAC;IAED,6DAA6D;IAC7D,oBAAoB,CAAC,QAAgB;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CACxB,gEAAgE,CACnE,CAAC,GAAG,CAAC,QAAQ,CAA0B,CAAC;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED,cAAc,CAAC,SAAiB,EAAE,KAAa;QAC3C,OAAQ,IAAI,CAAC,EAAE,CAAC,OAAO,CACnB,6BAA6B,KAAK,uBAAuB,CAC5D,CAAC,GAAG,CAAC,SAAS,CAAmB,CAAC,CAAC,CAAC;IACzC,CAAC;CACJ"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Database as DatabaseType } from "better-sqlite3";
|
|
2
|
-
export declare class SnapshotRepo {
|
|
3
|
-
private db;
|
|
4
|
-
constructor(db: DatabaseType);
|
|
5
|
-
getCached(key: string): {
|
|
6
|
-
value: string;
|
|
7
|
-
updated_at: string;
|
|
8
|
-
} | null;
|
|
9
|
-
upsert(key: string, value: string, timestamp: string, ttlMinutes: number): void;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=snapshot.repo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.repo.d.ts","sourceRoot":"","sources":["../../../src/repositories/snapshot.repo.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE/D,qBAAa,YAAY;IACT,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,YAAY;IAEpC,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAOpE,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;CAKlF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// Engram MCP Server — Snapshot Cache Repository
|
|
3
|
-
// ============================================================================
|
|
4
|
-
export class SnapshotRepo {
|
|
5
|
-
db;
|
|
6
|
-
constructor(db) {
|
|
7
|
-
this.db = db;
|
|
8
|
-
}
|
|
9
|
-
getCached(key) {
|
|
10
|
-
const row = this.db.prepare("SELECT value, updated_at FROM snapshot_cache WHERE key = ?").get(key);
|
|
11
|
-
return row ?? null;
|
|
12
|
-
}
|
|
13
|
-
upsert(key, value, timestamp, ttlMinutes) {
|
|
14
|
-
this.db.prepare("INSERT OR REPLACE INTO snapshot_cache (key, value, updated_at, ttl_minutes) VALUES (?, ?, ?, ?)").run(key, value, timestamp, ttlMinutes);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=snapshot.repo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.repo.js","sourceRoot":"","sources":["../../../src/repositories/snapshot.repo.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gDAAgD;AAChD,+EAA+E;AAI/E,MAAM,OAAO,YAAY;IACD;IAApB,YAAoB,EAAgB;QAAhB,OAAE,GAAF,EAAE,CAAc;IAAI,CAAC;IAEzC,SAAS,CAAC,GAAW;QACjB,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CACvB,4DAA4D,CAC/D,CAAC,GAAG,CAAC,GAAG,CAAsD,CAAC;QAChE,OAAO,GAAG,IAAI,IAAI,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,KAAa,EAAE,SAAiB,EAAE,UAAkB;QACpE,IAAI,CAAC,EAAE,CAAC,OAAO,CACX,iGAAiG,CACpG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAC7C,CAAC;CACJ"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Database as DatabaseType } from "better-sqlite3";
|
|
2
|
-
import type { TaskRow } from "../types.js";
|
|
3
|
-
export declare class TasksRepo {
|
|
4
|
-
private db;
|
|
5
|
-
constructor(db: DatabaseType);
|
|
6
|
-
create(sessionId: number | null, timestamp: string, data: {
|
|
7
|
-
title: string;
|
|
8
|
-
description?: string | null;
|
|
9
|
-
priority?: string;
|
|
10
|
-
status?: string;
|
|
11
|
-
assigned_files?: string[] | null;
|
|
12
|
-
tags?: string[] | null;
|
|
13
|
-
blocked_by?: number[] | null;
|
|
14
|
-
}): number;
|
|
15
|
-
update(id: number, timestamp: string, fields: {
|
|
16
|
-
status?: string;
|
|
17
|
-
priority?: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
assigned_files?: string[];
|
|
20
|
-
tags?: string[];
|
|
21
|
-
blocked_by?: number[];
|
|
22
|
-
completed_at?: string | null;
|
|
23
|
-
}): number;
|
|
24
|
-
getById(id: number): TaskRow | null;
|
|
25
|
-
getOpen(limit: number, resumeTask?: string): TaskRow[];
|
|
26
|
-
getFiltered(filters: {
|
|
27
|
-
status?: string;
|
|
28
|
-
priority?: string;
|
|
29
|
-
tag?: string;
|
|
30
|
-
includeDone?: boolean;
|
|
31
|
-
limit: number;
|
|
32
|
-
}): TaskRow[];
|
|
33
|
-
getByStatus(): Array<{
|
|
34
|
-
status: string;
|
|
35
|
-
count: number;
|
|
36
|
-
}>;
|
|
37
|
-
countDoneInSession(sessionId: number): number;
|
|
38
|
-
countAll(): number;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=tasks.repo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.repo.d.ts","sourceRoot":"","sources":["../../../src/repositories/tasks.repo.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,qBAAa,SAAS;IACN,OAAO,CAAC,EAAE;gBAAF,EAAE,EAAE,YAAY;IAEpC,MAAM,CACF,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE;QACF,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACjC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;KAChC,GACF,MAAM;IAgBT,MAAM,CACF,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;QACJ,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAChC,GACF,MAAM;IAkBT,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;IAInC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE;IAYtD,WAAW,CAAC,OAAO,EAAE;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,EAAE;IAeb,WAAW,IAAI,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAMvD,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAM7C,QAAQ,IAAI,MAAM;CAGrB"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// ============================================================================
|
|
2
|
-
// Engram MCP Server — Tasks Repository
|
|
3
|
-
// ============================================================================
|
|
4
|
-
export class TasksRepo {
|
|
5
|
-
db;
|
|
6
|
-
constructor(db) {
|
|
7
|
-
this.db = db;
|
|
8
|
-
}
|
|
9
|
-
create(sessionId, timestamp, data) {
|
|
10
|
-
const result = this.db.prepare("INSERT INTO tasks (session_id, created_at, updated_at, title, description, status, priority, assigned_files, tags, blocked_by) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)").run(sessionId, timestamp, timestamp, data.title, data.description || null, data.status || "backlog", data.priority || "medium", data.assigned_files ? JSON.stringify(data.assigned_files) : null, data.tags ? JSON.stringify(data.tags) : null, data.blocked_by ? JSON.stringify(data.blocked_by) : null);
|
|
11
|
-
return result.lastInsertRowid;
|
|
12
|
-
}
|
|
13
|
-
update(id, timestamp, fields) {
|
|
14
|
-
const sets = ["updated_at = ?"];
|
|
15
|
-
const params = [timestamp];
|
|
16
|
-
if (fields.status !== undefined) {
|
|
17
|
-
sets.push("status = ?");
|
|
18
|
-
params.push(fields.status);
|
|
19
|
-
}
|
|
20
|
-
if (fields.priority !== undefined) {
|
|
21
|
-
sets.push("priority = ?");
|
|
22
|
-
params.push(fields.priority);
|
|
23
|
-
}
|
|
24
|
-
if (fields.description !== undefined) {
|
|
25
|
-
sets.push("description = ?");
|
|
26
|
-
params.push(fields.description);
|
|
27
|
-
}
|
|
28
|
-
if (fields.assigned_files !== undefined) {
|
|
29
|
-
sets.push("assigned_files = ?");
|
|
30
|
-
params.push(JSON.stringify(fields.assigned_files));
|
|
31
|
-
}
|
|
32
|
-
if (fields.tags !== undefined) {
|
|
33
|
-
sets.push("tags = ?");
|
|
34
|
-
params.push(JSON.stringify(fields.tags));
|
|
35
|
-
}
|
|
36
|
-
if (fields.blocked_by !== undefined) {
|
|
37
|
-
sets.push("blocked_by = ?");
|
|
38
|
-
params.push(JSON.stringify(fields.blocked_by));
|
|
39
|
-
}
|
|
40
|
-
if (fields.completed_at !== undefined) {
|
|
41
|
-
sets.push("completed_at = ?");
|
|
42
|
-
params.push(fields.completed_at);
|
|
43
|
-
}
|
|
44
|
-
params.push(id);
|
|
45
|
-
return this.db.prepare(`UPDATE tasks SET ${sets.join(", ")} WHERE id = ?`).run(...params).changes;
|
|
46
|
-
}
|
|
47
|
-
getById(id) {
|
|
48
|
-
return this.db.prepare("SELECT * FROM tasks WHERE id = ?").get(id) ?? null;
|
|
49
|
-
}
|
|
50
|
-
getOpen(limit, resumeTask) {
|
|
51
|
-
if (resumeTask) {
|
|
52
|
-
const results = this.db.prepare("SELECT * FROM tasks WHERE status NOT IN ('done', 'cancelled') AND title LIKE ? ORDER BY priority, created_at").all(`%${resumeTask}%`);
|
|
53
|
-
if (results.length > 0)
|
|
54
|
-
return results;
|
|
55
|
-
}
|
|
56
|
-
return this.db.prepare("SELECT * FROM tasks WHERE status NOT IN ('done', 'cancelled') ORDER BY priority, created_at LIMIT ?").all(limit);
|
|
57
|
-
}
|
|
58
|
-
getFiltered(filters) {
|
|
59
|
-
let query = "SELECT * FROM tasks WHERE 1=1";
|
|
60
|
-
const params = [];
|
|
61
|
-
if (filters.status) {
|
|
62
|
-
query += " AND status = ?";
|
|
63
|
-
params.push(filters.status);
|
|
64
|
-
}
|
|
65
|
-
if (filters.priority) {
|
|
66
|
-
query += " AND priority = ?";
|
|
67
|
-
params.push(filters.priority);
|
|
68
|
-
}
|
|
69
|
-
if (filters.tag) {
|
|
70
|
-
query += " AND EXISTS (SELECT 1 FROM json_each(tags) WHERE value = ?)";
|
|
71
|
-
params.push(filters.tag);
|
|
72
|
-
}
|
|
73
|
-
if (!filters.includeDone) {
|
|
74
|
-
query += " AND status NOT IN ('done', 'cancelled')";
|
|
75
|
-
}
|
|
76
|
-
query += " ORDER BY CASE priority WHEN 'critical' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 END, created_at LIMIT ?";
|
|
77
|
-
params.push(filters.limit);
|
|
78
|
-
return this.db.prepare(query).all(...params);
|
|
79
|
-
}
|
|
80
|
-
getByStatus() {
|
|
81
|
-
return this.db.prepare("SELECT status, COUNT(*) as count FROM tasks GROUP BY status ORDER BY count DESC").all();
|
|
82
|
-
}
|
|
83
|
-
countDoneInSession(sessionId) {
|
|
84
|
-
return this.db.prepare("SELECT COUNT(*) as c FROM tasks WHERE session_id = ? AND status = 'done'").get(sessionId).c;
|
|
85
|
-
}
|
|
86
|
-
countAll() {
|
|
87
|
-
return this.db.prepare("SELECT COUNT(*) as c FROM tasks").get().c;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=tasks.repo.js.map
|