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.
Files changed (50) hide show
  1. package/package.json +1 -1
  2. package/packages/@monomind/cli/dist/src/agents/registry-builder.js +1 -1
  3. package/packages/@monomind/cli/dist/src/commands/doctor-project-checks.js +2 -3
  4. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.d.ts +1 -2
  5. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-commands.js +1 -2
  6. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.d.ts +1 -2
  7. package/packages/@monomind/cli/dist/src/commands/hooks-coverage-gaps.js +2 -117
  8. package/packages/@monomind/cli/dist/src/commands/hooks.js +1 -2
  9. package/packages/@monomind/cli/dist/src/commands/index.d.ts +0 -1
  10. package/packages/@monomind/cli/dist/src/commands/index.js +0 -1
  11. package/packages/@monomind/cli/dist/src/commands/security-misc.js +0 -1
  12. package/packages/@monomind/cli/dist/src/init/executor.d.ts +3 -0
  13. package/packages/@monomind/cli/dist/src/init/executor.js +20 -111
  14. package/packages/@monomind/cli/dist/src/mcp-client.js +0 -2
  15. package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +0 -1
  16. package/packages/@monomind/cli/dist/src/mcp-tools/index.js +0 -1
  17. package/packages/@monomind/cli/dist/src/mcp-tools/quality/coverage-analysis/track-trends.d.ts +4 -4
  18. package/packages/@monomind/cli/dist/src/mcp-tools/quality/test-generation/suggest-tests.d.ts +4 -4
  19. package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +0 -1
  20. package/packages/@monomind/cli/package.json +1 -1
  21. package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.d.ts +0 -134
  22. package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.js +0 -340
  23. package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.d.ts +0 -36
  24. package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.js +0 -125
  25. package/packages/@monomind/cli/dist/src/commands/benchmark.d.ts +0 -10
  26. package/packages/@monomind/cli/dist/src/commands/benchmark.js +0 -586
  27. package/packages/@monomind/cli/dist/src/commands/migrate.d.ts +0 -8
  28. package/packages/@monomind/cli/dist/src/commands/migrate.js +0 -789
  29. package/packages/@monomind/cli/dist/src/commands/monovector/backup.d.ts +0 -11
  30. package/packages/@monomind/cli/dist/src/commands/monovector/backup.js +0 -752
  31. package/packages/@monomind/cli/dist/src/commands/monovector/benchmark.d.ts +0 -11
  32. package/packages/@monomind/cli/dist/src/commands/monovector/benchmark.js +0 -502
  33. package/packages/@monomind/cli/dist/src/commands/monovector/import.d.ts +0 -18
  34. package/packages/@monomind/cli/dist/src/commands/monovector/import.js +0 -374
  35. package/packages/@monomind/cli/dist/src/commands/monovector/index.d.ts +0 -29
  36. package/packages/@monomind/cli/dist/src/commands/monovector/index.js +0 -129
  37. package/packages/@monomind/cli/dist/src/commands/monovector/init.d.ts +0 -11
  38. package/packages/@monomind/cli/dist/src/commands/monovector/init.js +0 -481
  39. package/packages/@monomind/cli/dist/src/commands/monovector/migrate.d.ts +0 -11
  40. package/packages/@monomind/cli/dist/src/commands/monovector/migrate.js +0 -500
  41. package/packages/@monomind/cli/dist/src/commands/monovector/optimize.d.ts +0 -11
  42. package/packages/@monomind/cli/dist/src/commands/monovector/optimize.js +0 -515
  43. package/packages/@monomind/cli/dist/src/commands/monovector/setup.d.ts +0 -18
  44. package/packages/@monomind/cli/dist/src/commands/monovector/setup.js +0 -775
  45. package/packages/@monomind/cli/dist/src/commands/monovector/status.d.ts +0 -11
  46. package/packages/@monomind/cli/dist/src/commands/monovector/status.js +0 -491
  47. package/packages/@monomind/cli/dist/src/commands/progress.d.ts +0 -11
  48. package/packages/@monomind/cli/dist/src/commands/progress.js +0 -261
  49. package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.d.ts +0 -14
  50. package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.js +0 -353
@@ -1,11 +0,0 @@
1
- /**
2
- * CLI MonoVector Status Command
3
- * Check connection and schema status
4
- */
5
- import type { Command } from '../../types.js';
6
- /**
7
- * MonoVector status command
8
- */
9
- export declare const statusCommand: Command;
10
- export default statusCommand;
11
- //# sourceMappingURL=status.d.ts.map
@@ -1,491 +0,0 @@
1
- /**
2
- * CLI MonoVector Status Command
3
- * Check connection and schema status
4
- */
5
- import { output } from '../../output.js';
6
- /**
7
- * Get PostgreSQL connection config from context
8
- */
9
- function getConnectionConfig(ctx) {
10
- return {
11
- host: ctx.flags.host || process.env.PGHOST || 'localhost',
12
- port: parseInt(ctx.flags.port || process.env.PGPORT || '5432', 10),
13
- database: ctx.flags.database || process.env.PGDATABASE || '',
14
- user: ctx.flags.user || process.env.PGUSER || 'postgres',
15
- password: ctx.flags.password || process.env.PGPASSWORD || '',
16
- ssl: ctx.flags.ssl || process.env.PGSSLMODE === 'require',
17
- schema: ctx.flags.schema || 'monomind',
18
- };
19
- }
20
- const IDENTIFIER_RE = /^[a-zA-Z_][a-zA-Z0-9_]{0,63}$/;
21
- function validateIdentifier(name, label) {
22
- if (!IDENTIFIER_RE.test(name))
23
- return `Invalid ${label}: "${name}" (must match [a-zA-Z_][a-zA-Z0-9_]{0,63})`;
24
- return null;
25
- }
26
- /**
27
- * Format bytes to human readable
28
- */
29
- function formatBytes(bytes) {
30
- if (bytes === 0)
31
- return '0 B';
32
- const k = 1024;
33
- const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
34
- const i = Math.floor(Math.log(bytes) / Math.log(k));
35
- return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
36
- }
37
- /**
38
- * MonoVector status command
39
- */
40
- export const statusCommand = {
41
- name: 'status',
42
- description: 'Check connection and schema status',
43
- options: [
44
- {
45
- name: 'verbose',
46
- short: 'v',
47
- description: 'Show detailed information',
48
- type: 'boolean',
49
- default: false,
50
- },
51
- {
52
- name: 'json',
53
- description: 'Output as JSON',
54
- type: 'boolean',
55
- default: false,
56
- },
57
- {
58
- name: 'host',
59
- short: 'h',
60
- description: 'PostgreSQL host',
61
- type: 'string',
62
- default: 'localhost',
63
- },
64
- {
65
- name: 'port',
66
- short: 'p',
67
- description: 'PostgreSQL port',
68
- type: 'number',
69
- default: 5432,
70
- },
71
- {
72
- name: 'database',
73
- short: 'd',
74
- description: 'Database name',
75
- type: 'string',
76
- },
77
- {
78
- name: 'user',
79
- short: 'u',
80
- description: 'Database user',
81
- type: 'string',
82
- },
83
- {
84
- name: 'password',
85
- description: 'Database password',
86
- type: 'string',
87
- },
88
- {
89
- name: 'ssl',
90
- description: 'Enable SSL',
91
- type: 'boolean',
92
- default: false,
93
- },
94
- {
95
- name: 'schema',
96
- short: 's',
97
- description: 'Schema name',
98
- type: 'string',
99
- default: 'monomind',
100
- },
101
- ],
102
- examples: [
103
- { command: 'monomind monovector status', description: 'Check basic status' },
104
- { command: 'monomind monovector status --verbose', description: 'Show detailed info' },
105
- { command: 'monomind monovector status --json', description: 'Output as JSON' },
106
- ],
107
- action: async (ctx) => {
108
- const config = getConnectionConfig(ctx);
109
- const verbose = ctx.flags.verbose;
110
- const jsonOutput = ctx.flags.json;
111
- if (!jsonOutput) {
112
- output.writeln();
113
- output.writeln(output.bold('MonoVector PostgreSQL Status'));
114
- output.writeln(output.dim('='.repeat(60)));
115
- output.writeln();
116
- }
117
- if (!config.database) {
118
- if (jsonOutput) {
119
- output.printJson({ error: 'Database name required' });
120
- }
121
- else {
122
- output.printError('Database name is required. Use --database or -d flag, or set PGDATABASE env.');
123
- }
124
- return { success: false, exitCode: 1 };
125
- }
126
- const schemaErr = validateIdentifier(config.schema, 'schema');
127
- if (schemaErr) {
128
- if (jsonOutput)
129
- output.printJson({ error: schemaErr });
130
- else
131
- output.printError(schemaErr);
132
- return { success: false, exitCode: 1 };
133
- }
134
- const statusData = {
135
- connection: {},
136
- pgvector: {},
137
- monovector: {},
138
- tables: [],
139
- indexes: [],
140
- migrations: [],
141
- };
142
- const spinner = output.createSpinner({ text: 'Connecting to PostgreSQL...', spinner: 'dots' });
143
- if (!jsonOutput)
144
- spinner.start();
145
- try {
146
- // Import pg
147
- let pg = null;
148
- try {
149
- pg = await import('pg');
150
- }
151
- catch {
152
- if (!jsonOutput)
153
- spinner.fail('PostgreSQL driver not found');
154
- if (jsonOutput) {
155
- output.printJson({ error: 'pg package not installed' });
156
- }
157
- else {
158
- output.printError('Install pg package: npm install pg');
159
- }
160
- return { success: false, exitCode: 1 };
161
- }
162
- const startTime = Date.now();
163
- const client = new pg.Client({
164
- host: config.host,
165
- port: config.port,
166
- database: config.database,
167
- user: config.user,
168
- password: config.password,
169
- ssl: config.ssl ? { rejectUnauthorized: false } : false,
170
- });
171
- await client.connect();
172
- const connectionTime = Date.now() - startTime;
173
- if (!jsonOutput)
174
- spinner.succeed(`Connected in ${connectionTime}ms`);
175
- statusData.connection = {
176
- host: config.host,
177
- port: config.port,
178
- database: config.database,
179
- user: config.user,
180
- ssl: config.ssl,
181
- latency: connectionTime,
182
- status: 'connected',
183
- };
184
- // Get PostgreSQL version
185
- const versionResult = await client.query('SELECT version()');
186
- const pgVersion = versionResult.rows[0].version;
187
- statusData.connection.pgVersion = pgVersion;
188
- // Check vector extension: prefer monovector, fall back to pgvector
189
- if (!jsonOutput)
190
- spinner.setText('Checking vector extension...');
191
- spinner.start();
192
- // Check for monovector first
193
- const monovectorResult = await client.query(`
194
- SELECT extname, extversion FROM pg_extension WHERE extname = 'monovector'
195
- `);
196
- if (monovectorResult.rows.length > 0) {
197
- statusData.pgvector = {
198
- installed: true,
199
- extensionName: 'monovector',
200
- version: monovectorResult.rows[0].extversion,
201
- };
202
- if (!jsonOutput) {
203
- spinner.succeed(`monovector v${monovectorResult.rows[0].extversion} installed`);
204
- }
205
- }
206
- else {
207
- // Fall back to pgvector
208
- const pgvectorResult = await client.query(`
209
- SELECT extname, extversion FROM pg_extension WHERE extname = 'vector'
210
- `);
211
- if (pgvectorResult.rows.length > 0) {
212
- statusData.pgvector = {
213
- installed: true,
214
- extensionName: 'vector',
215
- version: pgvectorResult.rows[0].extversion,
216
- };
217
- if (!jsonOutput) {
218
- spinner.succeed(`pgvector v${pgvectorResult.rows[0].extversion} installed`);
219
- }
220
- }
221
- else {
222
- statusData.pgvector = { installed: false };
223
- if (!jsonOutput) {
224
- spinner.succeed(output.warning('No vector extension installed (monovector or pgvector)'));
225
- }
226
- }
227
- }
228
- // Check schema exists
229
- if (!jsonOutput)
230
- spinner.setText(`Checking schema "${config.schema}"...`);
231
- spinner.start();
232
- const schemaResult = await client.query(`
233
- SELECT schema_name FROM information_schema.schemata WHERE schema_name = $1
234
- `, [config.schema]);
235
- if (schemaResult.rows.length === 0) {
236
- statusData.monovector = { initialized: false };
237
- if (!jsonOutput) {
238
- spinner.succeed(output.warning(`Schema "${config.schema}" not found`));
239
- output.printInfo('Run `monomind monovector init` to initialize');
240
- }
241
- if (jsonOutput) {
242
- output.printJson(statusData);
243
- }
244
- await client.end();
245
- return { success: true, data: statusData };
246
- }
247
- if (!jsonOutput)
248
- spinner.succeed(`Schema "${config.schema}" found`);
249
- // Get MonoVector metadata
250
- if (!jsonOutput)
251
- spinner.setText('Loading MonoVector metadata...');
252
- spinner.start();
253
- try {
254
- const metadataResult = await client.query(`
255
- SELECT key, value FROM ${config.schema}.metadata
256
- `);
257
- const metadata = {};
258
- for (const row of metadataResult.rows) {
259
- metadata[row.key] = JSON.parse(row.value);
260
- }
261
- statusData.monovector = {
262
- initialized: true,
263
- version: metadata.monovector_version || 'unknown',
264
- dimensions: metadata.dimensions || 1536,
265
- initializedAt: metadata.initialized_at,
266
- };
267
- if (!jsonOutput)
268
- spinner.succeed('MonoVector metadata loaded');
269
- }
270
- catch {
271
- statusData.monovector = { initialized: true, version: 'unknown' };
272
- if (!jsonOutput)
273
- spinner.succeed(output.warning('Could not load MonoVector metadata'));
274
- }
275
- // Get table statistics
276
- if (!jsonOutput)
277
- spinner.setText('Gathering table statistics...');
278
- spinner.start();
279
- const tablesResult = await client.query(`
280
- SELECT
281
- t.table_name,
282
- pg_relation_size(quote_ident(t.table_schema) || '.' || quote_ident(t.table_name)) as table_size,
283
- pg_total_relation_size(quote_ident(t.table_schema) || '.' || quote_ident(t.table_name)) as total_size,
284
- (SELECT count(*) FROM ${config.schema}.embeddings) as row_count
285
- FROM information_schema.tables t
286
- WHERE t.table_schema = $1
287
- ORDER BY t.table_name
288
- `, [config.schema]);
289
- const tableStats = [];
290
- for (const row of tablesResult.rows) {
291
- // Get row count for each table
292
- let rowCount = 0;
293
- try {
294
- const countResult = await client.query(`SELECT count(*) as cnt FROM ${config.schema}.` +
295
- `${String(row.table_name).replace(/[^a-zA-Z0-9_]/g, '')}`);
296
- rowCount = parseInt(countResult.rows[0].cnt, 10);
297
- }
298
- catch {
299
- // Skip if can't count
300
- }
301
- tableStats.push({
302
- name: row.table_name,
303
- rows: rowCount,
304
- size: formatBytes(parseInt(row.table_size, 10)),
305
- totalSize: formatBytes(parseInt(row.total_size, 10)),
306
- });
307
- }
308
- statusData.tables = tableStats;
309
- if (!jsonOutput)
310
- spinner.succeed(`Found ${tableStats.length} tables`);
311
- // Get index information
312
- if (verbose) {
313
- if (!jsonOutput)
314
- spinner.setText('Gathering index information...');
315
- spinner.start();
316
- const indexResult = await client.query(`
317
- SELECT
318
- i.relname as index_name,
319
- t.relname as table_name,
320
- am.amname as index_type,
321
- pg_relation_size(i.oid) as index_size,
322
- idx.indisvalid as is_valid,
323
- idx.indisunique as is_unique
324
- FROM pg_index idx
325
- JOIN pg_class i ON i.oid = idx.indexrelid
326
- JOIN pg_class t ON t.oid = idx.indrelid
327
- JOIN pg_namespace n ON n.oid = t.relnamespace
328
- JOIN pg_am am ON am.oid = i.relam
329
- WHERE n.nspname = $1
330
- ORDER BY t.relname, i.relname
331
- `, [config.schema]);
332
- statusData.indexes = indexResult.rows.map(row => ({
333
- name: row.index_name,
334
- table: row.table_name,
335
- type: row.index_type,
336
- size: formatBytes(parseInt(row.index_size, 10)),
337
- valid: row.is_valid,
338
- unique: row.is_unique,
339
- }));
340
- if (!jsonOutput)
341
- spinner.succeed(`Found ${indexResult.rows.length} indexes`);
342
- }
343
- // Get migration status
344
- if (!jsonOutput)
345
- spinner.setText('Checking migration status...');
346
- spinner.start();
347
- try {
348
- const migrationsResult = await client.query(`
349
- SELECT version, name, applied_at
350
- FROM ${config.schema}.migrations
351
- ORDER BY version ASC
352
- `);
353
- statusData.migrations = migrationsResult.rows.map(row => ({
354
- version: row.version,
355
- name: row.name,
356
- appliedAt: row.applied_at,
357
- }));
358
- if (!jsonOutput)
359
- spinner.succeed(`${migrationsResult.rows.length} migrations applied`);
360
- }
361
- catch {
362
- statusData.migrations = [];
363
- if (!jsonOutput)
364
- spinner.succeed(output.warning('Could not read migrations table'));
365
- }
366
- await client.end();
367
- // Output results
368
- if (jsonOutput) {
369
- output.printJson(statusData);
370
- }
371
- else {
372
- output.writeln();
373
- // Connection info
374
- output.writeln(output.highlight('Connection:'));
375
- output.printTable({
376
- columns: [
377
- { key: 'property', header: 'Property', width: 20 },
378
- { key: 'value', header: 'Value', width: 40 },
379
- ],
380
- data: [
381
- { property: 'Host', value: config.host },
382
- { property: 'Port', value: String(config.port) },
383
- { property: 'Database', value: config.database },
384
- { property: 'User', value: config.user },
385
- { property: 'SSL', value: config.ssl ? 'Enabled' : 'Disabled' },
386
- { property: 'Latency', value: `${connectionTime}ms` },
387
- ],
388
- });
389
- output.writeln();
390
- // Vector extension info
391
- const pgvectorData = statusData.pgvector;
392
- const extDisplayName = pgvectorData.extensionName === 'monovector' ? 'MonoVector' : 'pgvector';
393
- output.writeln(output.highlight(`Vector Extension (${extDisplayName}):`));
394
- output.writeln(` Status: ${pgvectorData.installed ? output.success('Installed') : output.error('Not Installed')}`);
395
- if (pgvectorData.extensionName) {
396
- output.writeln(` Extension: ${pgvectorData.extensionName}`);
397
- }
398
- if (pgvectorData.version) {
399
- output.writeln(` Version: ${pgvectorData.version}`);
400
- }
401
- output.writeln();
402
- // MonoVector info
403
- output.writeln(output.highlight('MonoVector:'));
404
- const monovectorData = statusData.monovector;
405
- output.writeln(` Initialized: ${monovectorData.initialized ? output.success('Yes') : output.error('No')}`);
406
- if (monovectorData.version) {
407
- output.writeln(` Version: ${monovectorData.version}`);
408
- }
409
- if (monovectorData.dimensions) {
410
- output.writeln(` Dimensions: ${monovectorData.dimensions}`);
411
- }
412
- output.writeln();
413
- // Table statistics
414
- output.writeln(output.highlight('Table Statistics:'));
415
- output.printTable({
416
- columns: [
417
- { key: 'name', header: 'Table', width: 30 },
418
- { key: 'rows', header: 'Rows', width: 12 },
419
- { key: 'size', header: 'Size', width: 12 },
420
- { key: 'totalSize', header: 'Total Size', width: 12 },
421
- ],
422
- data: tableStats,
423
- });
424
- output.writeln();
425
- // Index information (verbose only)
426
- if (verbose && statusData.indexes.length > 0) {
427
- output.writeln(output.highlight('Index Health:'));
428
- output.printTable({
429
- columns: [
430
- { key: 'name', header: 'Index', width: 35 },
431
- { key: 'table', header: 'Table', width: 20 },
432
- { key: 'type', header: 'Type', width: 10 },
433
- { key: 'size', header: 'Size', width: 10 },
434
- { key: 'status', header: 'Status', width: 10 },
435
- ],
436
- data: statusData.indexes.map(idx => ({
437
- ...idx,
438
- status: idx.valid ? output.success('Valid') : output.error('Invalid'),
439
- })),
440
- });
441
- output.writeln();
442
- }
443
- // Migration status
444
- output.writeln(output.highlight('Migrations:'));
445
- const migrations = statusData.migrations;
446
- if (migrations.length === 0) {
447
- output.writeln(' No migrations applied');
448
- }
449
- else {
450
- output.printTable({
451
- columns: [
452
- { key: 'version', header: 'Version', width: 12 },
453
- { key: 'name', header: 'Name', width: 35 },
454
- { key: 'appliedAt', header: 'Applied At', width: 22 },
455
- ],
456
- data: migrations.map(m => ({
457
- ...m,
458
- appliedAt: new Date(m.appliedAt).toISOString().replace('T', ' ').substring(0, 19),
459
- })),
460
- });
461
- }
462
- output.writeln();
463
- // Summary
464
- const embeddingsTable = tableStats.find(t => t.name === 'embeddings');
465
- if (embeddingsTable) {
466
- output.printBox([
467
- `Total Vectors: ${embeddingsTable.rows.toLocaleString()}`,
468
- `Storage Used: ${embeddingsTable.totalSize}`,
469
- `Schema: ${config.schema}`,
470
- `Migrations: ${migrations.length} applied`,
471
- ].join('\n'), 'Summary');
472
- }
473
- }
474
- return { success: true, data: statusData };
475
- }
476
- catch (error) {
477
- if (!jsonOutput)
478
- spinner.fail('Status check failed');
479
- const errorMessage = error instanceof Error ? error.message : String(error);
480
- if (jsonOutput) {
481
- output.printJson({ error: errorMessage });
482
- }
483
- else {
484
- output.printError(errorMessage);
485
- }
486
- return { success: false, exitCode: 1 };
487
- }
488
- },
489
- };
490
- export default statusCommand;
491
- //# sourceMappingURL=status.js.map
@@ -1,11 +0,0 @@
1
- /**
2
- * v1 Progress CLI Command
3
- *
4
- * Check and manage v1 implementation progress.
5
- *
6
- * @module @monoes/cli/commands/progress
7
- */
8
- import type { Command } from '../types.js';
9
- export declare const progressCommand: Command;
10
- export default progressCommand;
11
- //# sourceMappingURL=progress.d.ts.map