super-memory-pro 0.2.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/README.md +247 -0
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +25 -0
- package/dist/config.js.map +1 -0
- package/dist/db/connection.d.ts +20 -0
- package/dist/db/connection.d.ts.map +1 -0
- package/dist/db/connection.js +66 -0
- package/dist/db/connection.js.map +1 -0
- package/dist/db/migrations/001_initial.sql +102 -0
- package/dist/db/migrations.d.ts +14 -0
- package/dist/db/migrations.d.ts.map +1 -0
- package/dist/db/migrations.js +86 -0
- package/dist/db/migrations.js.map +1 -0
- package/dist/db/queries.d.ts +24 -0
- package/dist/db/queries.d.ts.map +1 -0
- package/dist/db/queries.js +179 -0
- package/dist/db/queries.js.map +1 -0
- package/dist/hooks/event-handler.d.ts +13 -0
- package/dist/hooks/event-handler.d.ts.map +1 -0
- package/dist/hooks/event-handler.js +80 -0
- package/dist/hooks/event-handler.js.map +1 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/message-handler.d.ts +13 -0
- package/dist/hooks/message-handler.d.ts.map +1 -0
- package/dist/hooks/message-handler.js +47 -0
- package/dist/hooks/message-handler.js.map +1 -0
- package/dist/hooks/session-compactor.d.ts +15 -0
- package/dist/hooks/session-compactor.d.ts.map +1 -0
- package/dist/hooks/session-compactor.js +40 -0
- package/dist/hooks/session-compactor.js.map +1 -0
- package/dist/hooks/system-transform.d.ts +27 -0
- package/dist/hooks/system-transform.d.ts.map +1 -0
- package/dist/hooks/system-transform.js +76 -0
- package/dist/hooks/system-transform.js.map +1 -0
- package/dist/hooks/tool-handler.d.ts +14 -0
- package/dist/hooks/tool-handler.d.ts.map +1 -0
- package/dist/hooks/tool-handler.js +94 -0
- package/dist/hooks/tool-handler.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +152 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/index.d.ts +19 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +553 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/memory/extractor.d.ts +29 -0
- package/dist/memory/extractor.d.ts.map +1 -0
- package/dist/memory/extractor.js +426 -0
- package/dist/memory/extractor.js.map +1 -0
- package/dist/memory/index.d.ts +7 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +7 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/processor.d.ts +50 -0
- package/dist/memory/processor.d.ts.map +1 -0
- package/dist/memory/processor.js +199 -0
- package/dist/memory/processor.js.map +1 -0
- package/dist/memory/search.d.ts +35 -0
- package/dist/memory/search.d.ts.map +1 -0
- package/dist/memory/search.js +170 -0
- package/dist/memory/search.js.map +1 -0
- package/dist/memory/store.d.ts +32 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +112 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +49 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/middleware/async-handler.d.ts +11 -0
- package/dist/server/middleware/async-handler.d.ts.map +1 -0
- package/dist/server/middleware/async-handler.js +14 -0
- package/dist/server/middleware/async-handler.js.map +1 -0
- package/dist/server/middleware/error-handler.d.ts +11 -0
- package/dist/server/middleware/error-handler.d.ts.map +1 -0
- package/dist/server/middleware/error-handler.js +18 -0
- package/dist/server/middleware/error-handler.js.map +1 -0
- package/dist/server/routes/health.d.ts +2 -0
- package/dist/server/routes/health.d.ts.map +1 -0
- package/dist/server/routes/health.js +25 -0
- package/dist/server/routes/health.js.map +1 -0
- package/dist/server/routes/memory.d.ts +2 -0
- package/dist/server/routes/memory.d.ts.map +1 -0
- package/dist/server/routes/memory.js +139 -0
- package/dist/server/routes/memory.js.map +1 -0
- package/dist/server/schemas.d.ts +51 -0
- package/dist/server/schemas.d.ts.map +1 -0
- package/dist/server/schemas.js +23 -0
- package/dist/server/schemas.js.map +1 -0
- package/dist/tools/definitions.d.ts +130 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +78 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/index.d.ts +32 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +148 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/types.d.ts +108 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// ─── Tool Execution ─────────────────────────────────────────────────────────
|
|
2
|
+
// Actual implementations of mem_save, mem_search, mem_forget, mem_stats.
|
|
3
|
+
// These are called by the tool definitions in definitions.ts.
|
|
4
|
+
import { createMemory, searchMemories, deleteMemory, getMemoryStats } from '../db/queries.js';
|
|
5
|
+
// ─── Helpers ───────────────────────────────────────────────────────────────
|
|
6
|
+
/**
|
|
7
|
+
* Derive a stable project ID from a worktree directory path.
|
|
8
|
+
* Uses the last directory segment as the project identifier.
|
|
9
|
+
*/
|
|
10
|
+
function deriveProjectId(worktree) {
|
|
11
|
+
const normalized = worktree.replace(/\/+$/, '');
|
|
12
|
+
const segments = normalized.split('/');
|
|
13
|
+
const last = segments[segments.length - 1];
|
|
14
|
+
if (!last || last.length === 0)
|
|
15
|
+
return 'default';
|
|
16
|
+
return last.toLowerCase().replace(/[^a-z0-9_-]/g, '_');
|
|
17
|
+
}
|
|
18
|
+
// ─── mem_save ──────────────────────────────────────────────────────────────
|
|
19
|
+
/**
|
|
20
|
+
* Save a memory explicitly via tool call.
|
|
21
|
+
* Delegates to createMemory() with derived project context.
|
|
22
|
+
*/
|
|
23
|
+
export async function executeMemSave(args, context) {
|
|
24
|
+
try {
|
|
25
|
+
const memoryType = (args.type || 'explicit');
|
|
26
|
+
const importance = args.importance ?? 3;
|
|
27
|
+
const memory = await createMemory({
|
|
28
|
+
memory_type: memoryType,
|
|
29
|
+
key: args.key,
|
|
30
|
+
content: args.content,
|
|
31
|
+
importance,
|
|
32
|
+
project_id: deriveProjectId(context.worktree),
|
|
33
|
+
source: 'tool',
|
|
34
|
+
});
|
|
35
|
+
console.log(`[UltraMemory] Saved memory ${memory.id} (${memoryType}, importance=${importance})`);
|
|
36
|
+
return {
|
|
37
|
+
title: 'Memory Saved',
|
|
38
|
+
output: `✅ Memory saved successfully (ID: \`${memory.id}\`)\n\n**Key:** ${args.key}\n**Type:** ${memoryType}\n**Importance:** ${importance}`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
43
|
+
console.error('[UltraMemory] executeMemSave failed:', message);
|
|
44
|
+
return {
|
|
45
|
+
title: 'Memory Save Failed',
|
|
46
|
+
output: `❌ Failed to save memory: ${message}`,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// ─── mem_search ────────────────────────────────────────────────────────────
|
|
51
|
+
/**
|
|
52
|
+
* Search stored memories via tool call.
|
|
53
|
+
* Formats results as a clean numbered list for the LLM.
|
|
54
|
+
*/
|
|
55
|
+
export async function executeMemSearch(args, context) {
|
|
56
|
+
try {
|
|
57
|
+
const limit = args.limit ?? 10;
|
|
58
|
+
const results = await searchMemories({
|
|
59
|
+
query: args.query,
|
|
60
|
+
types: args.type ? [args.type] : undefined,
|
|
61
|
+
limit,
|
|
62
|
+
offset: 0,
|
|
63
|
+
});
|
|
64
|
+
if (results.length === 0) {
|
|
65
|
+
return {
|
|
66
|
+
title: 'Memory Search',
|
|
67
|
+
output: 'No memories found.',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const lines = results.map((r, i) => {
|
|
71
|
+
const mem = r.memory;
|
|
72
|
+
const imp = mem.importance >= 5 ? ' [high]' : mem.importance <= 2 ? ' [minor]' : '';
|
|
73
|
+
const type = mem.memory_type;
|
|
74
|
+
return `${i + 1}. **${mem.content}**${imp}\n ID: \`${mem.id}\` | Type: ${type} | Relevance: ${r.relevance.toFixed(3)}`;
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
title: 'Memory Search Results',
|
|
78
|
+
output: `Found ${results.length} memory/-ies:\n\n${lines.join('\n')}`,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
83
|
+
console.error('[UltraMemory] executeMemSearch failed:', message);
|
|
84
|
+
return {
|
|
85
|
+
title: 'Memory Search Failed',
|
|
86
|
+
output: `❌ Failed to search memories: ${message}`,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// ─── mem_forget ────────────────────────────────────────────────────────────
|
|
91
|
+
/**
|
|
92
|
+
* Delete a specific memory by ID via tool call.
|
|
93
|
+
*/
|
|
94
|
+
export async function executeMemForget(args, _context) {
|
|
95
|
+
try {
|
|
96
|
+
const deleted = await deleteMemory(args.id);
|
|
97
|
+
if (!deleted) {
|
|
98
|
+
return {
|
|
99
|
+
title: 'Memory Not Found',
|
|
100
|
+
output: `⚠️ Memory with ID \`${args.id}\` not found. It may have already been deleted.`,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
console.log(`[UltraMemory] Deleted memory ${args.id}`);
|
|
104
|
+
return {
|
|
105
|
+
title: 'Memory Deleted',
|
|
106
|
+
output: `✅ Memory \`${args.id}\` has been forgotten.`,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
111
|
+
console.error('[UltraMemory] executeMemForget failed:', message);
|
|
112
|
+
return {
|
|
113
|
+
title: 'Memory Delete Failed',
|
|
114
|
+
output: `❌ Failed to delete memory: ${message}`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// ─── mem_stats ─────────────────────────────────────────────────────────────
|
|
119
|
+
/**
|
|
120
|
+
* Get memory statistics via tool call.
|
|
121
|
+
* Returns counts grouped by memory type.
|
|
122
|
+
*/
|
|
123
|
+
export async function executeMemStats(_args, _context) {
|
|
124
|
+
try {
|
|
125
|
+
const stats = await getMemoryStats();
|
|
126
|
+
if (stats.length === 0) {
|
|
127
|
+
return {
|
|
128
|
+
title: 'Memory Statistics',
|
|
129
|
+
output: 'No memories stored yet.',
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
const total = stats.reduce((sum, s) => sum + s.count, 0);
|
|
133
|
+
const lines = stats.map((s) => `- **${s.type}**: ${s.count}`);
|
|
134
|
+
return {
|
|
135
|
+
title: 'Memory Statistics',
|
|
136
|
+
output: `**Total Memories:** ${total}\n\n**By Type:**\n${lines.join('\n')}`,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
catch (err) {
|
|
140
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
141
|
+
console.error('[UltraMemory] executeMemStats failed:', message);
|
|
142
|
+
return {
|
|
143
|
+
title: 'Memory Stats Failed',
|
|
144
|
+
output: `❌ Failed to retrieve memory statistics: ${message}`,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,yEAAyE;AACzE,8DAA8D;AAI9D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE9F,8EAA8E;AAE9E;;;GAGG;AACH,SAAS,eAAe,CAAC,QAAgB;IACvC,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CA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,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/** Memory type categories */
|
|
2
|
+
export declare const MEMORY_TYPES: readonly ["user_profile", "tech_stack", "project_context", "session", "pattern", "decision", "explicit"];
|
|
3
|
+
export type MemoryType = (typeof MEMORY_TYPES)[number];
|
|
4
|
+
/** Core memory record */
|
|
5
|
+
export interface MemoryRecord {
|
|
6
|
+
id: string;
|
|
7
|
+
memory_type: MemoryType;
|
|
8
|
+
project_id: string | null;
|
|
9
|
+
session_id: string | null;
|
|
10
|
+
key: string;
|
|
11
|
+
value: Record<string, unknown>;
|
|
12
|
+
content: string;
|
|
13
|
+
importance: number;
|
|
14
|
+
source: string;
|
|
15
|
+
metadata: Record<string, unknown>;
|
|
16
|
+
access_count: number;
|
|
17
|
+
created_at: string;
|
|
18
|
+
updated_at: string;
|
|
19
|
+
last_accessed_at: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** Create memory input */
|
|
22
|
+
export interface MemoryCreate {
|
|
23
|
+
memory_type: MemoryType;
|
|
24
|
+
project_id?: string | null;
|
|
25
|
+
session_id?: string | null;
|
|
26
|
+
key: string;
|
|
27
|
+
value?: Record<string, unknown>;
|
|
28
|
+
content: string;
|
|
29
|
+
importance?: number;
|
|
30
|
+
source?: string;
|
|
31
|
+
metadata?: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
/** Update memory input */
|
|
34
|
+
export interface MemoryUpdate {
|
|
35
|
+
content?: string;
|
|
36
|
+
value?: Record<string, unknown>;
|
|
37
|
+
importance?: number;
|
|
38
|
+
metadata?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
/** Memory search query */
|
|
41
|
+
export interface MemoryQuery {
|
|
42
|
+
query: string;
|
|
43
|
+
types?: MemoryType[];
|
|
44
|
+
project_id?: string;
|
|
45
|
+
limit?: number;
|
|
46
|
+
offset?: number;
|
|
47
|
+
}
|
|
48
|
+
/** Session record */
|
|
49
|
+
export interface Session {
|
|
50
|
+
id: string;
|
|
51
|
+
project_id: string | null;
|
|
52
|
+
summary: string | null;
|
|
53
|
+
message_count: number;
|
|
54
|
+
tokens_used: number;
|
|
55
|
+
started_at: string;
|
|
56
|
+
ended_at: string | null;
|
|
57
|
+
metadata: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
/** Project record */
|
|
60
|
+
export interface Project {
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
path: string | null;
|
|
64
|
+
description: string | null;
|
|
65
|
+
tech_stack: string[];
|
|
66
|
+
conventions: Record<string, unknown>;
|
|
67
|
+
metadata: Record<string, unknown>;
|
|
68
|
+
created_at: string;
|
|
69
|
+
updated_at: string;
|
|
70
|
+
}
|
|
71
|
+
/** Plugin configuration */
|
|
72
|
+
export interface PluginConfig {
|
|
73
|
+
/** PostgreSQL connection */
|
|
74
|
+
db: {
|
|
75
|
+
host: string;
|
|
76
|
+
port: number;
|
|
77
|
+
database: string;
|
|
78
|
+
user: string;
|
|
79
|
+
password: string;
|
|
80
|
+
maxConnections: number;
|
|
81
|
+
};
|
|
82
|
+
/** Memory server */
|
|
83
|
+
server: {
|
|
84
|
+
port: number;
|
|
85
|
+
host: string;
|
|
86
|
+
};
|
|
87
|
+
/** Memory behaviour */
|
|
88
|
+
memory: {
|
|
89
|
+
maxInjections: number;
|
|
90
|
+
minImportance: number;
|
|
91
|
+
autoExtract: boolean;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/** Search result with relevance */
|
|
95
|
+
export interface MemorySearchResult {
|
|
96
|
+
memory: MemoryRecord;
|
|
97
|
+
relevance: number;
|
|
98
|
+
}
|
|
99
|
+
/** Platform detection result */
|
|
100
|
+
export type Platform = 'linux' | 'darwin' | 'termux' | 'windows' | 'unknown';
|
|
101
|
+
/** Package manager info */
|
|
102
|
+
export interface PackageManager {
|
|
103
|
+
name: string;
|
|
104
|
+
installCmd: string;
|
|
105
|
+
available: boolean;
|
|
106
|
+
requ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C;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,2BAA2B;AAC3B,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,EAAE,EAAE;QACF,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,oBAAoB;IACpB,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,uBAAuB;IACvB,MAAM,EAAE;QACN,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,OAAO,CAAC;KACtB,CAAC;CACH;AAED,mCAAmC;AACnC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,gCAAgC;AAChC,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7E,2BAA2B;AAC3B,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// ─── Ultra Memory Type Definitions ───────────────────────────────────────────
|
|
2
|
+
/** Memory type categories */
|
|
3
|
+
export const MEMORY_TYPES = [
|
|
4
|
+
'user_profile',
|
|
5
|
+
'tech_stack',
|
|
6
|
+
'project_context',
|
|
7
|
+
'session',
|
|
8
|
+
'pattern',
|
|
9
|
+
'decision',
|
|
10
|
+
'explicit',
|
|
11
|
+
];
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAEhF,6BAA6B;AAC7B,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,cAAc;IACd,YAAY;IACZ,iBAAiB;IACjB,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
+
"name": "super-memory-pro",
|
|
4
|
+
"version": "0.2.0",
|
|
5
|
+
"description": "Ultra-persistent memory plugin for OpenCode — learn, remember, and recall across sessions",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"opencode",
|
|
8
|
+
"opencode-plugin",
|
|
9
|
+
"memory",
|
|
10
|
+
"persistent-memory",
|
|
11
|
+
"session-memory",
|
|
12
|
+
"ai-memory",
|
|
13
|
+
"llm-memory",
|
|
14
|
+
"typescript",
|
|
15
|
+
"postgresql",
|
|
16
|
+
"cross-platform",
|
|
17
|
+
"termux",
|
|
18
|
+
"plugin",
|
|
19
|
+
"developer-tool"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./server": {
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc && cp -r src/db/migrations dist/db/migrations",
|
|
38
|
+
"dev": "tsx watch src/index.ts",
|
|
39
|
+
"install:plugin": "tsx src/installer/index.ts",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest",
|
|
42
|
+
"typecheck": "tsc --noEmit",
|
|
43
|
+
"clean": "rm -rf dist"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@opencode-ai/plugin": "^1.15.0",
|
|
47
|
+
"express": "^5.1.0",
|
|
48
|
+
"pg": "^8.14.1",
|
|
49
|
+
"uuid": "^11.1.0",
|
|
50
|
+
"zod": "^4.1.8"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/express": "^5.0.2",
|
|
54
|
+
"@types/node": "^22.15.3",
|
|
55
|
+
"@types/pg": "^8.11.14",
|
|
56
|
+
"@types/uuid": "^10.0.0",
|
|
57
|
+
"tsx": "^4.19.4",
|
|
58
|
+
"typescript": "^5.8.3",
|
|
59
|
+
"vitest": "^3.1.3"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=18.0.0"
|
|
63
|
+
},
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"homepage": "https://github.com/luftwaffe66/Super-Memory#readme",
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "git+https://github.com/luftwaffe66/Super-Memory.git"
|
|
69
|
+
}
|
|
70
|
+
}
|